Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pdftalk4gemstone [2017/10/12 14:50] christian [Extension methods] |
pdftalk4gemstone [2022/03/07 10:31] (current) bekki |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== PDFtalk for Gemstone ====== | ====== PDFtalk for Gemstone ====== | ||
- | Library for reading and writing PDF files in Gemstone. | + | Library for reading and writing PDF files in [[https:// |
- | The source comes in two files: **'' | + | The source |
- | The library | + | With [[releasenotes# |
The new symbol dictionary **'' | The new symbol dictionary **'' | ||
- | The namespaces from VisualWorks are implemented by symbol dictionaries in Gemstone. Therefore, the '' | + | The namespaces from VisualWorks are implemented by symbol dictionaries in Gemstone. Therefore, the '' |
- | {{:pdftalk_namespaces.png? | + | {{:namespaces_gemstone.png? |
Accessing classes in namespaces is written differently. For example: | Accessing classes in namespaces is written differently. For example: | ||
Line 24: | Line 24: | ||
The dictionary '' | The dictionary '' | ||
+ | |||
+ | With the [[releasenotes# | ||
===== Get started ===== | ===== Get started ===== | ||
- | FileIn | + | The proper way to get the fileout is to create it. For convenience, |
- | ==== Tests and Demos ==== | + | |
+ | ==== File out Gemstone code ==== | ||
+ | |||
+ | To create the fileout, you need to load the bundle '' | ||
+ | <code smalltalk> | ||
+ | SmalltalkTransform.Gemstone fileOutPDFtalk. | ||
+ | SmalltalkTransform.Gemstone fileOutPDFtalkTesting. | ||
+ | </code> | ||
+ | |||
+ | You should change the directory in the two methods. | ||
+ | ==== File into Gemstone ==== | ||
+ | |||
+ | The library should be installed in the open source [[https://github.com/GsDevKit/GsDevKit_home|GsDevKit]] for Gemstone. In this installation, | ||
+ | |||
+ | You have to log into GsDevKit as '' | ||
+ | To file-in the code do: | ||
+ | < | ||
+ | output push PDFtalk.log only | ||
+ | input PDFtalk.gs | ||
+ | output pop | ||
+ | exit | ||
+ | </ | ||
+ | |||
+ | The created log file MUST be checked for problems. If you see: | ||
+ | |||
+ | < | ||
+ | topaz 1> # | ||
+ | topaz 1> # Finished file-in successfully | ||
+ | topaz 1> # | ||
+ | fileformat is now 8bit | ||
+ | topaz 1> output pop | ||
+ | </ | ||
+ | |||
+ | ...then everything is OK and PDFtalk can be used. In case of a problem, you will see an error message with a useful stacktrace. | ||
+ | |||
+ | Do the same to load '' | ||
+ | |||
+ | When doing this repeatedly, one need to undo and clean up the previous installation | ||
+ | < | ||
+ | output push cleanUp.log only | ||
+ | Doit | ||
+ | | policy | | ||
+ | # | ||
+ | (GsPackageLibrary packageNamed: | ||
+ | GsPackageLibrary uninstallPackage: | ||
+ | (GsPackageLibrary packageLibrary removeDictionaryNamed: | ||
+ | policy := GsPackagePolicy current. | ||
+ | policy homeSymbolDict: | ||
+ | policy externalSymbolList: | ||
+ | policy enable. | ||
+ | % | ||
+ | commit | ||
+ | </ | ||
+ | |||
+ | ===== Look around ===== | ||
+ | |||
+ | Loading '' | ||
+ | |||
+ | ==== Tests ==== | ||
- | Inspect | + | Print the following: |
<code smalltalk> | <code smalltalk> | ||
PDF runAllTests | PDF runAllTests | ||
</ | </ | ||
- | It should show 245 passing | + | and check that 497 tests are passing |
+ | |||
+ | ==== Demos ==== | ||
+ | |||
+ | In the '' | ||
The demos write the test PDFs in the $HOME directory on the Gemstone server. | The demos write the test PDFs in the $HOME directory on the Gemstone server. | ||
For demos 12, 13 and 14 you need to put the {{pdf: | For demos 12, 13 and 14 you need to put the {{pdf: | ||
- | To quickly | + | To quickly |
<code smalltalk> | <code smalltalk> | ||
PDF runAllDemos | PDF runAllDemos | ||
</ | </ | ||
- | |||
to find many generated PDFs in your $HOME directory. | to find many generated PDFs in your $HOME directory. | ||
+ | |||
+ | The last demo appends all demo PDFs into this {{ : | ||
===== Runtime considerations ===== | ===== Runtime considerations ===== | ||
- | There are some global variables caching objects (fonts, encodings, the type hierarchy). These caches are lazily filled when accessed first. In a runtime, you may want to reset and fill all caches before deploying, either because of limited rights of the runtime user or to eliminate startup overhead-. | + | There are some global variables caching objects (fonts, encodings, the type hierarchy). These caches are lazily filled when accessed first. In a runtime, you may want to reset and fill all caches before deploying, either because of limited rights of the runtime user or to eliminate startup overhead. |
After all your application code is loaded, do the following to reset and fill all caches: | After all your application code is loaded, do the following to reset and fill all caches: | ||
Line 57: | Line 122: | ||
===== Images ===== | ===== Images ===== | ||
- | There is code to save ImageXObjects as Value (i.e. source code which will reconstruct | + | There is code to save ImageXObjects as Value (i.e. source code which will reconstruct |
- | To produce the source string for a PDF image you send it '' | + | To produce the source string for a PDF image you send it '' |
- | This string can be evaluated in Gemstone with #evaluate and will reconstruct the ImageXObject, | + | This string can be evaluated in Gemstone with '' |
- | #evaluate works when the '' | + | '' |
- | I did not add any helper methods for saving or reading the string to / from disk… | + | I did not add any helper methods for saving or reading the string to / from disk. |
My preferred way is to store such resources as methods. This may or may not work with your workflow. | My preferred way is to store such resources as methods. This may or may not work with your workflow. | ||
For this, I added a helper on ImageXObject. | For this, I added a helper on ImageXObject. | ||
- | To save a PDF image a class method of ImageXObject, | + | To save a PDF image as a class method of ImageXObject, |
<code smalltalk> | <code smalltalk> | ||
anImageXObject asMethod: selectorSymbol in: protocolSymbol package: packageString | anImageXObject asMethod: selectorSymbol in: protocolSymbol package: packageString | ||
</ | </ | ||
- | I added several example images with this to ImageXObject. You can also look at the new ImageXTests where the images are used. | + | I added several example images with this to ImageXObject. You can also look at ImageXTests where the images are used. |
These methods can be transferred easily form VW to Gemstone and you get the image just by calling that method. | These methods can be transferred easily form VW to Gemstone and you get the image just by calling that method. | ||
- | ===== older ideas about porting ===== | ||
- | |||
- | [[: | ||
- | Older thoughts and discussion about [[Porting]]. |