170 likes | 337 Views
More on locales. Locale : A locale in POSIX has two components: 1.Collection of rules and text specific to a language in a specific geographic area(locale files) 2.Set of functions which can be used to set and use locale files.
E N D
More on locales • Locale: A locale in POSIX has two components: 1.Collection of rules and text specific to a language in a specific geographic area(locale files) 2.Set of functions which can be used to set and use locale files. In short, I18N and L10n are carried out by preparing locale files based on the rules in component 1 so that the functions in component 2 can be properly defined for use
Collation: A collation specifies a sorting order. • Example: Input output If you want A A a C B A a C b B a B b b C • Prepare a collation sequence LC_COLLATE order_start <a> <A> <b> <B> …...
Open Systems • Open System is specifically designed to accommodate components from various vendors with three distinct perspectives: Portability, interoperability, and integration
Portability:The aspect of a component that allows it to be used in various environments • Program portability: software that can be used in different language environment/platform • Data portability: Data produced by a program on a certain platform can be readily used on another platform/environment
Interoperability: refers to the ability of individual components within an open system to exchange information with other components (which may be heterogeneous).
Integration: is concerned with the consistency of various human-machine interfaces between an individual and all hardware/software in the system
What is an Open system: an open system is one in which the components are built on some open specifications. • Why open systems: Enables competing organizations to use these standard components to build competitive systems. • Specification(規範,規定): a description of a system/component functionality through the description of its interface behavior. • Example: C library, parallel port
Technical Foundation of open system • An open system component must follow some open specification(規範) • We characterize technical aspects of open systems along three coordinates: If a system supports the exchange of information among various components of similar levels, then it supports interoperability. If a sub-system(component or part) can be moved from one environment to another, it is said to be portable. An integrated set of applications (components or parts) provides a consistent (user) interface.
Examples: • Interoperability: X.25, TCP/IP, HTTP, • Portability: • Operating systems: POSIX, X/Open, • Data management: FTP, SQL • Programming languages: C, Fortran • Integration: • User programming interfaces: X, Motif, Microsoft Windows ActiveX,
Writing Portable Software (a2): retrieve data and put in X ... float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<8; j++) getc(x[i+j], tape); ….. (a1): back up data in X … float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<8; j++) putc(x[i+j], tape); • The program assumes that a floating point number is 8 bytes in length • Save a floating point number as 8 bytes of characters
What is the problem with (a)? • Is the Program Portable? • What if the data length for floating point number on different machines are different? • If longer: Only part of the data will be saved • If shorter: run-time error!(saving beyond range) => Change the source code and recompile! • What if the data formats(different floating point number processor) are different? • getc( ) will mis-interpret data.
(b2): ... float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<sizeof(float); j++) getc(x[i+j], tape); (b1): ... float x[N]; … for (i=0; i<N; i++) FOR (j=0; j<sizeof(float); j++) putc(x[i+j], tape); ….. • Any problem with (b)? • Program portable? • With respect to data length? • With respect to data format? • Data portable?
(c1): … • float x[N]; • … • for (i=0; i<N; i++) • fprintf(tape,”%f”,x[i]); • ….. (c1): … • float x[N]; • … • for (i=0; i<N; i++) fscanf(fromTape, “%f”,x[i]);
Porting for different languages/culture customs (a): …… printf(“Date: %d/%d/%d”, m, d, yr+2000) …… (b): …… #define LANG x …… { char date[8]; … set_date(date,m,d,yr+2000); printf(“date: %s”, date); … } set_date(date,month,day,year) char *date; int month, day, year; { switch( LANG) { case USA: <encode date as “month/day/year”>; break; case GERMANY: <encode date as “day.month.year”>; break; …. }; return; } not quite portable => internationalization
Portability • Writing one piece of software which can be used in different environment without the need to change the source code • Hardware • Operating systems • Language environment