Pergi ke kandungan

PostScript

Daripada Wikipedia, ensiklopedia bebas.
PostScript
Fail:PostScript 3.svg
ParadigmaBerbilang paradigma: berasaskan tindanan, tatacara
Muncul pada1982
Direka olehJohn Warnock & Chuck Geschke
PembangunAdobe Systems
Lepasan stabilPostScript 3 (1997)
Disiplin penjenisanDinamik, kuat
Pelaksanaan utamaAdobe PostScript, TrueImage, Ghostscript, InterPress
DipengaruhiLisp
MempengaruhiPDF
PostScript
Sambungan fail:.ps
Jenis media Internet:application/postscript
Pengecam Jenis Seragam:com.adobe.postscript
Magik:%!
Dibangunkan oleh:Adobe Systems
Jenis format:Format fail pencetakan
Diperluas kepada:PostScript Berkapsul

PostScript (PS) ialah bahasa pengaturcaraan perangkaian jenis dinamik yang dicipta oleh John Warnock dan Charles Geschke pada 1982. Ia paling terkenal kerana penggunaannya sebagai bahasa perihal halaman dalam bidang elektronik dan penerbitan meja.

Sejarah

Konsep untuk bahasa PostScript dilahirkan pada 1976 semasa John Warnock bekerja di Evans & Sutherland, sebuah syarikat grafik komputer yang termasyhur. Pada waktu itu, beliau sedang membangunkan perisian pentafsir untuk pangkalan data grafik tiga-dimensi pelabuhan New York. Warnock memikirkan bahasa Design System untuk memproses grafik.

Pada waktu yang sama, para penyelidik di Xerox PARC telah berjaya membangunkan pencetak laser yang pertama dan menyedari keperluan untuk menggunakan cara yang standard untuk mentakrifkan imej halaman. Kemudian pada 1975-76, sebuah pasukan yang diketuai oleh Bob Sproull membangunkan format Press yang kemduian digunakan dalam sistem Xerox Star untuk menjalankan pencetak laser. Bagaimanapun, Press merupakan format data dan bukan sebuah bahasa dan justera itu, tidak mempunyai kebolehubahan. PARC kemudian memulakan usaha [InterPress]] untuk mencipta penggantinya.

Pada 1978, Evans dan Sutherland meminta Warnock berpindah dari [[San Francisco Bay Area] ke ibu pejabat utama mereka di Utah, akan tetapi Warnock tidak berminat. Namum beliau menyertai Xerox PARC untuk bekerja dengan Martin Newell. Bersama-sama, mereka menulis semula Design System untuk mencipta JaM (singkatan untuk "John and Martin") yang kemudian digunakan untuk reka bentuk VLSI serta penyelidikan pencetakan taip dan grafik. Karya itu kemudian berkembang menjadi bahasa InterPress.

Warnock kemudian meletakkan jawatan bersama-sama dengan Chuck Geschke untuk mengasaskan Adobe Systems pada Disember 1982. Mereka mencipta sebuah bahasa yang serupa dengan InterPress, tetapi lebih mudah, dikenali PostScript, yang dipasarkan pada 1984. Pada waktu yang lebih kurang sama, mereka dikunjungi oleh Steve Jobs yang menggalakkannya menyesuaikan PostScript untuk digunakan sebagai bahasa untuk menjalankan pencetak laser.

In March 1985, the Apple LaserWriter was the first printer to ship with PostScript, sparking the desktop publishing (DTP) revolution in the mid-1980s. The combination of technical merits and widespread availability made PostScript a language of choice for graphical output for printing applications. For a time an interpreter (sometimes referred to as a RIP for Raster Image Processor) for the PostScript language was a common component of laser printers, into the 1990s.

However, the cost of implementation was high; computers output raw PS code that would be interpreted by the printer into a raster image at the printer's natural resolution. This required high performance microprocessors and ample memory. The LaserWriter used a 12 MHz Motorola 68000, making it faster than any of the Macintosh computers it attached to. When the laser printer engines themselves cost over a thousand dollars the added cost of PS was worthwhile, but as printer mechanisms fell in price, the cost of implementing PS became increasingly expensive.

Once the de facto standard for electronic distribution of final documents meant for publication, PostScript is steadily being supplanted in this area by one of its own descendants, the Portable Document Format or PDF. By 2001 there were fewer printer models which came with support for PostScript, largely due to the growing competition from much cheaper non-PostScript ink jet printers, and new software-based methods to render PostScript images on the computer, making them suitable for any printer (PDF provided one such method). The use of a PostScript laser printer still can, however, significantly reduce the CPU workload involved in printing documents, transferring the work of rendering PostScript images from the computer to the printer. PS is still an option on most "high end" models.

Bahasa

PostScript is a Turing-complete programming language, belonging to the concatenative group. Typically, PostScript programs are not produced by humans, but by other programs. However, it is possible to write computer programs in PostScript just like any other programming language.

PostScript is an interpreted, stack-based language similar to Forth but with strong dynamic typing, data structures inspired by those found in Lisp, scoped memory and, since language level 2, garbage collection. The language syntax uses reverse Polish notation, which makes the order of operations unambiguous, but reading a program requires some practice, because one has to keep the layout of the stack in mind. Most operators (what other languages term functions) take their arguments from the stack, and place their results onto the stack. Literals (for example numbers) have the effect of placing a copy of themselves on the stack. Sophisticated data structures can be built on the array and dictionary types, but cannot be declared to the type system, which sees them all only as arrays and dictionaries, so any further typing discipline to be applied to such user-defined "types" is left to the code that implements them.

The character "%" is used to introduce comments in PostScript programs. As a general convention, every PostScript program should start with the characters "%!" so that all devices will properly interpret it as PostScript.

"Hello world"

A Hello World program, the customary way to show a small example of a complete program in a given language, might look like this in Postscript:

%!PS
/Courier findfont
20 scalefont
setfont
72 500 moveto
(Hello world!) show
showpage

or if the output device has a console

%!PS
(Hello world!) =

Unit ukuran

Postscript uses the point as its unit of length. However, unlike some other versions of the point, PostScript uses exactly 72 points to the inch. Thus:

For example, in order to draw horizontal line of 4cm length, it is sufficient to type:

0 0 moveto 
0 113.385827 lineto stroke

PostScript uses single-precision reals (24-bit mantissa), so it is not meaningful to use more than 9 decimal digits to specify a real number. For draft graphics, the number of significant digits may be reduced.

Lihat juga

Rujukan

Rencana ini pada asalnya berdasarkan bahan daripada Free On-line Dictionary of Computing yang dilesenkan di bawah GFDL.

Pautan luar