Dynamic conversion of byte ordering for use on different processor platforms

Information

  • Patent Grant
  • 6351750
  • Patent Number
    6,351,750
  • Date Filed
    Friday, October 16, 1998
    25 years ago
  • Date Issued
    Tuesday, February 26, 2002
    22 years ago
Abstract
The invention is a method for dynamically converting the byte-ordering of a data structure of a resource type from a first format to a second format, the first format being incompatible with the second format. The method comprises the following steps: (a) creating a template which corresponds to the data structure of the resource type, the template having a structure in a third format which is compatible with the first and second formats; (b) linking the template to the resource type; and (c) converting automatically the byte-ordering of the data structure of the resource type from the first format to the second format using the template.
Description




BACKGROUND OF THE INVENTION




1. Field of the Invention




The present invention relates generally to a distribution system of digital contents, i.e., digitally encoded published materials. More particularly, the invention relates to a method for dynamically converting the byte-ordering of a data structure in a digital content from one format to a different format.




2. Description of Related Art




Advances in computer and communication technology have provided the consumers a convenient and economical means to access information in a variety of media. One particular area of information access is the electronic books. An electronic book is a viewing device that receives printed materials in the form of digital data downloaded from an information network. A user of an electronic book can read downloaded contents of books and printed materials subscribed from a participating bookstore at his or her own convenience without the need to purchase the printed copies of the books.




An electronic book, or any other viewing device, has persistent memory, such as a hard disk or a flash random-access-memory (RAM), to store the downloaded digital contents and constitutes a particular processor platform.




Digital contents stored as binary data in persistent memory of a viewing device must be readable in the native byte-ordering format of the processor of the viewing device. For performance reasons, certain processors require the byte-ordering of numeric values to be in specific formats. These formats may be different for different types of processors. For example, for use on a Motorola 680x0 chip, the 2-byte hexadecimal number 3AF7 is stored in RAM as: 3A in byte


1


, F7 in byte


2


. For use on an Intel processor, the same number is stored in RAM as: F7 in byte


1


, 3A in byte


2


. The Motorola chip format is called big endian format, and the Intel chip format is called little endian format. The conversion of raw numerical data from one format to the other is further complicated by the fact that the byte-swapping must depend on individual data element sizes. Without knowing the individual data element sizes, it is not possible to convert raw binary numerical data from one format to the other. For instance, two 2-byte numbers are indistinguishable from one 4-byte number. Consider the big endian data ABCD where A, B, C and D are bytes. This data may be two 2-byte numbers, namely, AB and CD, or it may be a single 4-byte number ABCD. Since byte swapping must be done for individual numbers, the resulting little endian data are either BADC if the big endian data are two 2-byte numbers, or DCBA if the big endian data is a single 4-byte number.




For optimal performance, binary data should be stored in the endian format of the final target processor platform for which it is created. However, this is not possible if there is more than one target processor platform and the platforms are not compatible. For example, in a digital content distribution system which includes a virtual bookstore and two different groups of viewing devices which run on two incompatible types of processors, a digital content stored in one endian format at the virtual bookstore can be directly used by one group of viewing devices, but must be converted to a different endian format to be used by the other group. Performing conversion of byte-ordering at the viewing device level is time-consuming and prone to errors, specially when the data structure has a complex combination of data types and contains nested lists of other structures. In addition, a change to a data structure will require every user of that structure to change its conversion.




Therefore, currently, there is a need for an efficient method to dynamically convert the byte-ordering of a data structure from one endian format to another endian format for use on a different processor platform.




SUMMARY OF THE INVENTION




The present invention is a method for dynamically converting the byte-ordering of a data structure of a resource type from a first format to a second format, the first format being incompatible with the second format. The method comprises the following steps: (a) creating a template which corresponds to the data structure of the resource type, the template having a structure in a third format which is compatible with the first and second formats; (b) linking the template to the resource type; and (c) converting automatically the byte-ordering of the data structure of the resource type from the first format to the second format using the template.











BRIEF DESCRIPTION OF THE DRAWINGS





FIG. 1

is a diagram illustrating a system in which the present invention can be practiced.





FIG. 2

is a flowchart illustrating one embodiment of the present invention.





FIG. 3

is a table describing some values of the template used in the present invention.











DETAILED DESCRIPTION OF THE INVENTION




The present invention is a method and system for dynamically converting the byte-ordering of a data structure of a resource type from a first format to a second format which is incompatible with the first format. The method includes the steps of creating a template having a structure which corresponds to the data structure of the resource type, the template structure being in a third format which is compatible with the first and second formats, linking the template structure to the resource type, and automatically converting the byte-ordering of the data structure of the resource type from the first format to the second format using the template structure.




In the following description, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that these specific details are not required in order to practice the present invention.





FIG. 1

is a diagram illustrating a system


100


in which one embodiment of the invention can be practiced.




Referring to

FIG. 1

, the system


100


comprises: (a) at least one portable electronic book


10


operative to request a digital content from a catalog of distinct digital contents, to receive and display the requested digital content in readable form; (b) an information services system


20


which includes an authentication server


32


for authenticating the identity of the requesting portable electronic book


10


and a copyright protection server


22


for rendering the requested digital content sent to the requesting portable electronic book


10


readable only by the requesting portable electronic book


10


; (c) at least one primary virtual bookstore


40


in electrical communication with the information services system


20


, the primary virtual bookstore being a computer-based storefront accessible by the portable electronic book and including the catalog of distinct digital contents; and (d) a repository


50


, in electrical communication with the primary virtual bookstore


40


, for storing the distinct digital contents listed in the catalog.




The system


100


preferably includes more than one portable electronic book


10


, to be commercially viable. This is illustrated in

FIG. 1

by including the portable electronic books


12


and


14


. The system also preferably includes more than one primary virtual bookstore


40


, each serving a different set of customers, each customer owning a portable electronic book.




The system


100


can further comprise a secondary virtual bookstore


60


in electrical communication with the information services system


20


. In this case, the information services system


20


also includes a directory of virtual bookstores


26


in order to provide the portable electronic book


10


with access to the secondary virtual bookstore


60


and its catalog of digital contents.




The information services system


20


can optionally include a notice board server for sending messages from one of the virtual bookstores, primary or secondary, to a portable electronic book in the system.




The information services system


20


also includes a registration server


24


for keeping track of the portable electronic books that are considered active accounts in the system and for ensuring that each portable electronic book is associated with a primary virtual bookstore in the system. In the case where the optional notice board server is included in the information services system


20


, the registration server


24


also allows each portable electronic book user to define his/her own notice board and document delivery address.




The information services system


20


preferably comprises a centralized bookshelf


30


associated with each portable electronic book


10


in the system. Each centralized bookshelf


30


contains all digital contents requested and owned by the associated portable electronic book


10


. Each portable electronic book


10


user can permanently delete any of the owned digital contents from the associated centralized bookshelf


30


. Since the centralized bookshelf


30


contains all the digital contents owned by the associated portable electronic book


10


, these digital contents may have originated from different virtual bookstores. The centralized bookshelf


30


is a storage extension for the portable electronic book


10


. Such storage extension is needed since the portable electronic book


10


has limited non-volatile memory capacity.




The user of the portable electronic book


10


can add marks, such as bookmarks, inking, highlighting and underlining, and annotations on a digital content displayed on the screen of the portable electronic book, then stores this marked digital content in the non-volatile memory of the electronic book


10


. The user can also upload this marked digital content to the information services system


20


to store it in the centralized bookshelf


30


associated with the portable electronic book


10


, for later retrieval. It is noted that there is no need to upload any unmarked digital content, since it was already stored in the centralized bookshelf


30


at the time it was first requested by the portable electronic book


10


.




The information services system


20


further includes an Internet Services Provider (ISP)


34


for providing Internet network access to each portable electronic book in the system.




In the system


100


of

FIG. 1

, a digital content stored in the repository


50


of the virtual bookstore


40


or in the centralized bookshelf


30


may include numerical values which are stored as binary data in an endian format. If the requesting portable electronic book


10


runs on a processor platform which is incompatible with this endian format, then the byte-ordering of the binary data have to be converted to the other endian format.




Binary data are stored in a number of different record structures. Each structure has an arbitrarily complex combination of data types which may include 2-byte and 4-byte integer values, with and without alignment, NULL terminated strings, counted strings (1-byte and 2-byte counts), points (2-byte or 4-byte integer pairs), etc. In addition, these structures may contain nested lists of other structures. The nested lists may be counted lists or indefinite lists. Thus, due to the complexity of data structures, performing conversion of byte-ordering at the electronic book level is time-consuming and prone to errors. In addition, a change to a data structure will require every user of that data structure to change its conversion.




The present invention allows the byte-ordering conversion to be performed dynamically at the server end of the system of FIG.


1


.





FIG. 2

is a flowchart illustrating one embodiment of the present invention.




Upon START, the process


200


reads a data structure of a resource type requested by a device. The data structure is stored in format


1


in a simple database system of a server (Block


202


). This simple database system is usually called the resource file system.




The process then creates a template describing the data structure of the resource type (Block


204


). The structure of this template is in a format which is compatible with both format


1


and format


2


. The template structure is a series of 1-byte values that represent individual data elements of the data structure of the resource type. This one-byte format is compatible to both endian formats discussed above, and does not require any conversion of the byte ordering.




The process


200


then links the template to the resource type (Block


206


). The template is preferably stored in the same resource file as that of the resource type.




When a device requests the data of the resource type, process


200


determines whether the requesting device uses format


1


for byte-ordering (Block


208


). If the requesting device uses format


1


, then the data of the resource type as stored in the database system is sent to the requesting device (Block


210


). Then, the process


200


is terminated.




If the requesting device does not use format


1


, then process


200


converts the byte-ordering of the data structure of the resource type from format


1


to format


2


using the template (Block


212


). Then, the process


200


is terminated.




One of the most important elements of the invention is the easily expandable template. Since the template structure is in the format of 1-byte values, byte swapping is not required, making it compatible to any platform. In addition, any change to a data structure layout require only a single change in the corresponding template for all users of that data.





FIG. 3

shows the description of some template values. The template data can be expanded to include more values.




Each template describes a resource type. For example, a resource type may have the following data structure, where a short is a 2-byte integer, a long is a 4-byte integer, and a char is a single byte:





















Short




vl;







Short




v2;







Char




v3;







Long




v4;







Short




v5;















The template for this resource type is the following integer stream, using the byte values from FIG.


3


:




2,2,1,4,3,2




or, equivalently, as text:




Short, Short, Byte, Short align, Long, Short




In this example, the template has one more value than the number of elements in the structure. The data for this structure may be aligned, that is, the individual data elements may need to start on 2-byte or 4-byte boundaries. In this example, the alignment is for 2 byte boundaries, forcing the “char” to take 2 bytes, but treating the second byte as padding to be disposed, not as data to be swapped.




The following are additional examples of data structures and their corresponding templates:




1. The following long aligned data structure:





















Short




s1;







Byte




flags;







Long point




lp1;















 corresponds to the following template:




Short, byte, long align, long point




2. The following short aligned structure:























Short





sl;








Char*




strl;







Long





count;




// count for following string







Char*




str2;















 corresponds to the following template:




Short, NULL terminated string, short align, long counted string




3. The following short aligned data structure which includes a number of lists:























Short






slc;







{








Short





sl;








Byte





s2;







}







long






11c;







{








long





sllc;








{









short




s3;









short




s4;








}








char*





str;







}







{








short




s4;








long




l1;







}















 corresponds to the following template:




begin short counted list, short, byte, short align, end list, begin long counted list, begin long counted list, short, short, end list, NULL terminated string, short align, end list, begin indefinite list, short, long




4. The following data structure which consists of a simple list:






















Short





slc;







{








long




l1;








short




sl;







}















 corresponds to the following template:




begin short counted list, long, short, end counted list




An example of such a simple data structure is a 2-element list with values {ABCD, EF}, {UVWX, YZ}. This data structure would be stored in persistent big endian memory as:


02


ABCDEFUVWXYZ, where


02


indicates that there are two elements in the list, each element consists of a long integer followed by a short integer. After using the template to convert the byte-ordering of the data, the data will be stored in the memory of a little endian device as:


2


ODCBAFEXWVUZY.




While certain exemplary embodiments have been described in detail and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative of and not restrictive on the broad invention, and that this invention is not to be limited to the specific arrangements and constructions shown and described, since various other modifications may occur to those with ordinary skill in the art.



Claims
  • 1. A method for providing a dynamically converted, byte-ordered data structure of a resource type to a device, the data structure being converted from a first format to a second format, the first format being incompatible with the second format, the method comprising the steps of:(a) creating a template corresponding to the data structure of the resource type, the template having a structure in a third format, the third format being compatible with the first and second formats; (b) linking the template to the resource type; and (c) converting automatically the byte-ordering of the data structure of the resource type from the first format to the second format using the template; and (d) sending the converted data structure of the resource type to the device.
  • 2. The method of claim 1 wherein the template is expandable.
  • 3. The method of claim 1 wherein the template structure comprises one-byte values.
  • 4. The method of claim 1 wherein the first format is a big endian format and the second format is a little endian format.
  • 5. The method of claim 1 wherein the template includes a value representing a byte.
  • 6. The method of claim 1 wherein the template includes a value representing one selected from the list of a byte, a short integer, a long integer, a short align indicator, a long align indicator, a null terminated string, a short counted string, a byte counted string, a short point, a long point, an indefinite list, a start of a short counted list, a start of a long counted list, and an end of a counted list.
  • 7. A system for dynamically converting byte-ordering of a data structure of a resource type from a first format to a second format, the first format being incompatible with the second format, the system comprising:(a) a server including: a resource file system having a database for storing the resource type, the resource type being stored in a first format, the resource file system creating a template corresponding to the data structure of the resource type, the template having a template structure in a third format, the third format being compatible with the first and second formats, the resource file system linking the template to the resource type; and (b) a device in electrical communication with the server, the device requesting the resource type in the second format; wherein the resource file system automatically converts the byte-ordering of the data structure of the resource type from the first format to the second format using the template.
  • 8. The system of claim 7 wherein the device is an electronic book.
  • 9. The system of claim 7 wherein the server is a virtual bookstore.
US Referenced Citations (93)
Number Name Date Kind
3718906 Lightner Feb 1973 A
4159417 Rubincam Jun 1979 A
D276626 Lockwood Dec 1984 S
4490810 Hon Dec 1984 A
4545023 Mizzi Oct 1985 A
4575621 Dreifus Mar 1986 A
4591974 Dornbush et al. May 1986 A
4597058 Izumi et al. Jun 1986 A
4601011 Grynberg Jul 1986 A
4649499 Sutton et al. Mar 1987 A
D289777 Thomas May 1987 S
4682161 Bugg Jul 1987 A
4725977 Izumi et al. Feb 1988 A
4779080 Coughlin et al. Oct 1988 A
4820167 Nobles et al. Apr 1989 A
4855725 Fernandez Aug 1989 A
4899292 Montagna et al. Feb 1990 A
4916441 Gombrich Apr 1990 A
4918632 York Apr 1990 A
4972496 Sklarew Nov 1990 A
4985697 Boulton Jan 1991 A
5021989 Fujisawa et al. Jun 1991 A
5025373 Keyser, Jr. et al. Jun 1991 A
5031119 Dulaney et al. Jul 1991 A
5065345 Knowles et al. Nov 1991 A
5091939 Cole et al. Feb 1992 A
5107415 Sato et al. Apr 1992 A
5109354 Yamashita et al. Apr 1992 A
5115508 Hatta May 1992 A
5121492 Saville, III et al. Jun 1992 A
5133076 Hawkins et al. Jul 1992 A
5146552 Cassorla et al. Sep 1992 A
D330544 Kane Oct 1992 S
5157491 Kassatly Oct 1992 A
5157737 Sklarew Oct 1992 A
5157783 Anderson et al. Oct 1992 A
5199104 Hirayama Mar 1993 A
5203001 Yanagiuchi et al. Apr 1993 A
5214696 Keiser, II et al. May 1993 A
5221838 Gutman et al. Jun 1993 A
5222136 Rasmussen et al. Jun 1993 A
5226080 Cole et al. Jul 1993 A
5231662 van Rumpt et al. Jul 1993 A
5233333 Borsuk Aug 1993 A
5239665 Tsuchiya Aug 1993 A
D339329 Lacko Sep 1993 S
5245656 Loeb et al. Sep 1993 A
5247661 Hager et al. Sep 1993 A
5253294 Maurer Oct 1993 A
5265259 Satou et al. Nov 1993 A
D346620 McSorely May 1994 S
5319582 Ma Jun 1994 A
5333116 Hawkins et al. Jul 1994 A
5339091 Yamazaki et al. Aug 1994 A
5359707 Sato Oct 1994 A
5365598 Sklarew Nov 1994 A
5367621 Cohen et al. Nov 1994 A
5379057 Clough et al. Jan 1995 A
5388196 Pajak et al. Feb 1995 A
5392387 Friztpatrick et al. Feb 1995 A
5398310 Tchao et al. Mar 1995 A
5404505 Levinson Apr 1995 A
D359306 Lande et al. Jun 1995 S
5428606 Moskowitz Jun 1995 A
5438344 Oliva Aug 1995 A
D362271 Luong Sep 1995 S
D362272 Luong Sep 1995 S
D362461 Luong Sep 1995 S
5457746 Dolphin Oct 1995 A
5463725 Henckel et al. Oct 1995 A
5465213 Ross Nov 1995 A
5467102 Kuno et al. Nov 1995 A
5475399 Borsuk Dec 1995 A
5477510 Ukita Dec 1995 A
5483586 Sussman Jan 1996 A
5557790 Bingham et al. Sep 1996 A
5594919 Turkowski Jan 1997 A
5598470 Cooper et al. Jan 1997 A
5615264 Kazmierczak et al. Mar 1997 A
5629980 Stefik et al. May 1997 A
5638443 Stefik et al. Jun 1997 A
5697793 Huffman et al. Dec 1997 A
5719943 Amada et al. Feb 1998 A
5734823 Saigh et al. Mar 1998 A
5734891 Saigh Mar 1998 A
5781763 Beukema et al. Jul 1998 A
5828884 Lee et al. Oct 1998 A
5919117 Hansen Oct 1998 A
5903779 Park May 1999 A
5907865 Moyer May 1999 A
5918075 Paysan Jun 1999 A
5961640 Chambers et al. Oct 1999 A
6021275 Horwat Feb 2000 A
Foreign Referenced Citations (12)
Number Date Country
0 390 611 Mar 1990 EP
0 751 655 Jan 1997 EP
2 657 451 Jan 1990 FR
2 657 187 Jul 1991 FR
2 149 544 Jun 1995 GB
07 219823 Dec 1995 JP
WO 8701481 Mar 1987 WO
WO 8905023 Jun 1989 WO
9415269 Jul 1994 WO
9714101 Apr 1997 WO
WO 9720274 Jun 1997 WO
WO 9806034 Dec 1998 WO
Non-Patent Literature Citations (11)
Entry
James “Multiplexed Buses: The Endian Wars Continue”, IEEE 1990, pp. 9-21.*
Nadeau et al “Image Handling in a Multi-vendor Environment”, IEEE 1991, pp. 276-283.*
Dvorak, et al. Methodology for User Centred Link Structures for Textbook to Hypertext Conversion, IEEE, Jan. 1992, pp. 619-628.
Pobiak Adjustable Access Electronic Books, IEEE, Jan. 1992, pp. 90-94.
Ramos Making Book on Electronic Books, College Store Journal—Sep./Oct. 1992.
Cox Technology Threatens to Shatter the World of College Textbooks The Wall Street Journal—Electronic Campus, Jun. 1, 1993
Watanabe et al., Visual Interface for Retrieval of Electronic-Formed Books, IEEE, Jul. 1993, pp. 692-695.
The Heller Report, Oct. 1993.
Ziegler IBM to Unveil Plan to Skip Disks, Send Software by Satellite, The Wall Street Journal, Nov. 1, 1994.
Fisher This Little Compute rTries to be a Book, St. Louis Post-Dispatch, Jan. 4, 1995.
Steinert-Threlkeld Now, Data by Satellite, Inter@ctive Week (no date).