GithubHelp home page GithubHelp logo

xpost's People

Contributors

hzeller avatar luser-dr00g avatar mulle-kybernetik-tv avatar thorstenb avatar vtorri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xpost's Issues

itp does not catch interrupt signal and trigger PS-level /interrupt error.

What steps will reproduce the problem?
1. make, make install
2. itp
3. ctrl-C

What is the expected output? What do you see instead?

Under the executive, it should abort the current computation, print an error 
message, and resume with a PS> prompt.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 28 Oct 2013 at 9:24

contact

What steps will reproduce the problem?
1. opening website
2.
3.

What is the expected output? What do you see instead?

Mail or contact to author.

What version of the product are you using? On what operating system?

All up to the issue.

Please provide any additional information below.

Hey, contact me - I'm doing a postscript interpreter in Lua at the moment. I'm 
about as far as you probably - while I do have other preferences to do first.

-Helmar helmwo at gmail dot com

Original issue reported on code.google.com by [email protected] on 10 Jan 2011 at 3:56

itp does not accept filenames from command-line

What steps will reproduce the problem?
1. make, make install
2. itp data/test.ps
3. test not run, issues a prompt.

What is the expected output? What do you see instead?

Expected to run the data/test.ps program in the interpreter. Instead it issues 
a PS> prompt in the same way it does if no command-line arguments were given.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 28 Oct 2013 at 8:45

xpost does not work as a library component for another program

What steps will reproduce the problem?
1. make
2. library created does not export full program functionality
3.

What is the expected output? What do you see instead?

It is expected to be able to link xpost - The Library - as a component
of a third-party program. It should accept configuration parameters to return 
output to the calling program and to execute specified postscript fragments 
either by filename or as a string buffer. 

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 29 Oct 2013 at 5:09

Remove integer automaton from grok()

The floating-point automaton detects integers as well, as a different returned state. Therefore we can call check() once instead of twice and discriminate the two cases by calling the accept functions on the result.

This should speed-up all parsing as the number tests are applied first, contrary to the behavior of FORTH.

itp does not create a gui window to display graphical output

What steps will reproduce the problem?
1. make, make install
2. itp
3. no graphics window

What is the expected output? What do you see instead?

As a postscript interpreter, Xpost will be used to preview postscript graphics 
and documents. It should open a Window and display graphical output either 
after `showpage` or after all painting operators.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 28 Oct 2013 at 8:50

Dictionaries should store access level in VM to fit postscript semantics

What steps will reproduce the problem?
1. 1 dict dup readonly pop
2. /a 1 put
3. should trigger an /invalidaccess error

What is the expected output? What do you see instead?

Dictionaries (and files) have the same access in all shared copies 
of the object. So the access functions in xpost_object.c should store the 
access level in vm with the data so it is shared.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 30 Oct 2013 at 9:21

'itp' is a stupid name. it should be 'xpost'! :)

What steps will reproduce the problem?
1. make
2.
3.

What is the expected output? What do you see instead?

`make` makes a program called 'itp'. The project is called "Xpost". ??!

The program should be called 'xpost'.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 30 Oct 2013 at 9:29

Bug in arc fill.

What steps will reproduce the problem?
1. xpost_client
2. xpost_client_out.ppm contains incompletely filled circle

also exhibited by xpost_main with
3. 300 400 100 0 360 arc fill

What is the expected output? What do you see instead?

It should draw a big black circle. Instead there's a faint circular outline, 
and a chord from (0,+r) to (+r,0) is filled.

Please use labels and text to provide additional information.

Since the same problem is exhibited in 2 different devices, that traces it to 
the path operators. I now suspect it's the way arc creates its curves.

Original issue reported on code.google.com by luser.droog on 9 Oct 2014 at 9:12

Don't use precious 'ent's in 'saverec's!

What steps will reproduce the problem?
1. runtest is running out of 'ent's.
2.
3.

What is the expected output? What do you see instead?

runtest executes the file testdraw.ps which performs some
relatively simple postscript drawing with pseudo-randomly 
generated points. It really ought to execute this program
without difficulty.


Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 4 Dec 2013 at 12:47

Improve performance of stack type checking in opexec

What steps will reproduce the problem?
1. execution of operator objects
2.
3. algorithmic improvement -> possible order-of-magnitude speedup

What is the expected output? What do you see instead?

Operator objects are executed by a series of simple steps,

  * get pointer to OPTAB, the operator table
  * get struct oper object from optab
  * get signature block (a character string of type* ids)
  * iterate through signatures
    * check signature against stack
    * copy args from stack to holding-stack
    * call op-function associated with *this* matched signature
      accessing hold-stack contents via pointers

The "check signature against stack" is the problem here (and it was pieces of 
this "optimization" that led to the unnecessary UINT128 which isn't portable). 
*The type ids in the signature are extended with "pattern types": anytype which 
matches any object (count has already been checked previously), numbertype 
which matches either int or real, floattype which matches reals and promotes 
ints to reals, and proctype which is shorthand for executable array. Now the 
executable attribute is already in the tag field where the type is stored, but 
to pack these signature blocks tightly, these are stored as characters and 
masked to just the bits of the type sub-field, so the extended-type-id patterns 
do not clash with the flags which may use the higher bits. Hm... That detail is 
not particularly important here, but is for descriptive purposes. :)

The current implementation is what I usually call "the nasty loop". It's in 
xpost_operator.c:opexec()//

  * for each signature
    * if stack_count < sig.args
       - err = stackunderflow, next signature
    * for each type-pattern in sig
       * if anytype, 
           next type-pattern
       * if type-pattern matches the type of the stack object in that position,
           next type-pattern
       * if pattern is numbertype and corresponding stack object is int or float,
           next type-pattern
       * if pattern is floattype
           * if stack object is int
              promote to float
           * if stack object is real
              next type-pattern
       * if pattern is proctype
             and stack object is array
             and stack object is executable
              next type-pattern
       * else
           err = typecheck
           next signature

What I'd really like to do is match this type object as a large integer with 
bitwise logic. 8 bytes is 64bits, or UINT64 or unsigned long long. So the 
program logic could be simpler:

    * take "digest" of stack types
    * for each signature
        * compare type-pattern-block word-wise against digest
        * if good, 
           call op-function and return success
    * return error

The word-wise type comparison then becomes a nasty logic puzzle, but look how 
clean the code becomes!!! It's sooo pretty, it's *got* to be fast. Look at how 
many conditional branches are eliminated! That's got to zip through the 
pipeline faster, right? right? amiright??!

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 28 Feb 2014 at 8:27

Simplify operator execution by pushing args backwards

The function _xpost_operator_push_args_to_hold() does one loop to copy args, and a second loop to pop them from the operand stack.

If we access args in reverse order, this could be simplified to 1 push(pop()) loop.

Cache name objects to factor-out ternary-search-tree lookups in device functions

What steps will reproduce the problem?
1. All graphics operations
2.
3.

What is the expected output? What do you see instead?

Graphics operations have to perform dictionary lookups with
name objects, but the creation of the name object from a string
is an additional layer of processing which could be removed
from the graphics operators and placed in the initialization.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 3 Dec 2013 at 3:17

xpost_file_read(), and hence readstring, doesn't deal with end of file

readstring effectively boils down to a call to xpost_file_read() and xpost_file_read() doesn't do anything special when it reaches end of file. The function is:

int xpost_file_read(char *buf, int size, int count, Xpost_File *fp)
{
    int i, j, k = 0;

    for (i = 0; i < count; ++i)
        for (j = 0; j < size; ++j)
            buf[k++] = xpost_file_getc(fp);

    return i;
}

This is guaranteed to return count.

There needs to be a test on whether xpost_file_getc() has returned EOF, and, if it has, the code needs to break out of the i loop. Note that this will need to test the return value of xpost_file_getc() before it's written into buf[], for the usual getc-returns-an-int reasons.

A simple test input is:

{currentfile 10 string readstring pstack} exec
abc

This should return substring (abc\n) (could be "\n", "\r\n" or nothing at the end depending exactly how the file terminates) and false. xpost returns a ten character string padded with character 255 and true

Here's are TIO links for the simple test: xpost (failing) and Ghostscript (working).

A stronger test is:

{currentfile 10 string readstring exch print not {exit} if} loop
This is several lines
of text, these should be
printed exactly as they
appear in the input and
should end just after the
end of this sentence, with
any newlines that were in
the input.

Currently this will give an infinite loop with xpost.

With this bug fixed, it's not clear what xpost_file_read() should do if the number of bytes remaining in the file is not a multiple of size (assuming it's also less than count × size). It will read all the remaining bytes and return the number of whole items it read. This will imply it read i × size bytes when it actually read up to size − 1 more bytes. This is probably correct behaviour, but at least should be documented in the code.

While I'm here, in xpost_op_file.c, the comments documenting the inputs and outputs of readhexstring, readstring and readline are wrong. They all imply that if the functions hit end of file then they return just false without a substring. In fact, if they always return a substring. The code is correct in all three cases. (Note that read has a similar comment, but in that case it's correct, as is the code).

`restore` does not close files opened since `save`

What steps will reproduce the problem?
1. save (myfile)(w)file
2. restore
3. file should be closed now.

What is the expected output? What do you see instead?

The save/restore mechanism needs an extra record type and behavior to track 
file objects. File creation operators must register their objects with the save 
stack. Restore must close file objects if their Low-Level is above the new 
level.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 29 Oct 2013 at 5:19

Make separate memory tables for various typed-objects.

What steps will reproduce the problem?
1. There is a hard maximum of 65535 'ent's accessible through the PS object
2. This means that there may only be 65535 vm allocations, total, per memory 
file, including all strings, dicts, names, um, arrays. Each of these is an ent.
3. This imposes a constraint on program complexity lower than the PLRM 
describes.

This burden could be somewhat relieved by including the type of the object as 
an additional memory identifier.

I propose to add additional SPECIAL entities SPECIAL_ARRAY SPECIAL_DICT 
SPECIAL_STRING to each memory file's table-zero. These special ents would point 
to head's of additional memory-table-chains specifically for objects of that 
type. Names and strings would still share the same space.

This would permit these limits:
65535 global names or strings
65535 local names or strings
65535 global arrays
65535 local arrays
65535 global dicts
65535 local dicts

Oh, and SPECIAL_FILE, too.

This would have an impact on the garbage collector logic, but I expect it would 
facilitate improvements there, too.

Original issue reported on code.google.com by luser.droog on 1 Dec 2013 at 12:54

FT_Load_Glyph returns error 35 on Linux

What steps will reproduce the problem?
1. testfont
2.
3.

What is the expected output? What do you see instead?

Under mingw, I see the correct output. Under Cygwin, I see gibberish, but 
visible gibberish. Under Linux (Ubuntu), I get error 35, which according to 
/usr/include/freetype2/freetype/fterrdef.h means:

  FT_ERRORDEF_( Invalid_Face_Handle,                0x23, \
                "invalid face handle" )


Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 15 Dec 2013 at 7:07

Translate the Path ADT to C.

What steps will reproduce the problem?
1. The path structure is a large memory burden.
2.
3.

What is the expected output? What do you see instead?

The path data structure is referenced in most drawing operations
up to the final 'stroke' or 'fill' operations which execute a 
painting method in the device.

If implemented in C, it could use the Xpost_Stack for extensible
lists, even representing the path in normal postscript syntax:
10 10 moveto 20 20 lineto 30 30 40 40 50 50 60 60 curveto closepath

The path implementation would need to interact with the (currently)
postscript-level implementation of the graphics state. Probably in a
similar manner to the device implementations, by adding a /Private
member to the gstate dict.

There should be speed improvements from this as well, since many 
postscript actions would be replaced by a single postscript action.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 3 Dec 2013 at 4:48

FreeType bitmap fonts not scaling

What steps will reproduce the problem?
1. mingw: testfont
2. Cygwin: 100 100 moveto /Times-Roman 40 selectfont (Hello World!) show
3.

What is the expected output? What do you see instead?

When using a .fon font in mingw or a .pcf.gz font in Cygwin, the
font is much smaller than the requested point size of 40.


Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 22 Dec 2013 at 8:20

Increase performance of `flattenpath` algorithm

What steps will reproduce the problem?
1.
2.
3. all curve drawing

What is the expected output? What do you see instead?

Xpost currently converts curves into line segments using a recursive 
DeCasteljau subdivision. But there's an algorithm called "adaptive subdivision" 
which may be quite a bit faster (and with better quality) by reducing the 
number of line segments on the uninteresting spans of the curve.

Illustration:
http://codegolf.stackexchange.com/a/22155/2381

Article:
http://www.antigrain.com/research/adaptive_bezier/index.html#PAGE_ADAPTIVE_BEZIE
R

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 8 Sep 2014 at 7:26

invalid object bug.

What steps will reproduce the problem?
1. uncommenting the "orientation box fill" in testdraw.ps
2. Triggers an invalid object error 2 pages later in the fat curves.
3.

What is the expected output? What do you see instead?

It should execute all of this code with no difficulty. Mysterious bug. I 
strongly suspect the save/restore mechanism and/or garbage collection.


Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 2 Dec 2013 at 11:39

Increase performance of the hash tables

The (large) number of calls to xpost_object_compare() by the dictionary functions could be cut considerably by storing the actual hashed key in the table. Table elements would now become triples: (hash, key, value) and the compare function only needs to be called upon the key objects if the hash values compare exactly equal (a cheap 32bit compare).

itp does not accept '-DDEVICE=XXX' option and '-o Filename%d' option to render output to named file(s) in a standard interchange format.

What steps will reproduce the problem?
1. make, make install
2. itp -DDEVICE=pgm -o fern.pgm fern.ps
3. no file created

What is the expected output? What do you see instead?

Expected to create a pgm file (for example) containing a rendering of the image 
described by fern.ps.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 28 Oct 2013 at 8:55

optimize typechecks and polymorphic dispatch from procedure bodies in `bind`

bind is the postscript call to create an optimized, read-only procedure body.

We can add an additional optimization to the usual replacement of names with operator objects, and that is: input/output type analysis and removal of internal typechecks. As a simple example, the mod operator, if its inputs are correct, produces an integertype object, so if a procedure begins with the sequence mod copy ... say, then we know that this is the integer-case of copy and don't need to do dynamic typechecking and polymorphic dispatch at runtime to select the correct integer-case function; we can factor this out to a different representation at bind time.

One complication is that the procedure body remains accessible as a regular postscript array, so any operator objects extracted, using get perhaps, must decay back to their fully-typechecked, polymorphic version.

make the dump file not temporary

xpost_log_init() uses mkstemp() to create a unique file name, but the file is 
temporary. We should use another method to create a safe non temporary file

Original issue reported on code.google.com by [email protected] on 10 Dec 2013 at 8:50

unit tests do not compile on Windows

Make check on Windows leads to undefined symbols. Reason : memory and stack functions are not exported.

One possible solution : correctly define XPCHECKAPI in xpost_private.h:

ifdef HAVE_CHECK

define XPCHECKAPI XPAPI

else

define XPCHECKAPI

endif

and declare/define functions used in unit tests with XPCHECKAPI

remarks ?

Names should accept embedded nul-characters.

What steps will reproduce the problem?
1. (\0)cvn ()cvn eq
2.
3. ==> yields true,  should be: false

What is the expected output? What do you see instead?

Nametype objects should be able to contain nul (zero) characters
as part of the identifier. 

Please use labels and text to provide additional information.

This is the last holdover of using the "C" string convention
(nul designated the end of the string) in the interpreter.
Everywhere else, counted (+optional offset) strings are used.
And the actual char*s are handled very carefully since 
memory may move and invalidate the pointer after any new 
allocation.

Returning the string identifier is already content-transparent
as the associated strings for the name integer code is in a
stack of objects, which is already generic.

But the string->integer conversion is done with ternary search
tree which uses a test for nul as the recursion bound in tree
creation, and the success criterion in tree search.

So, the search tree itself needs to be redesigned to carry
an extra count variable in the creation calls, and to designate
an end-of-string property for a tree node.

Original issue reported on code.google.com by luser.droog on 21 Mar 2014 at 5:52

add opengl support

add opengl support for faster rendering

currently, on Windows and unix, GDI and XCB are used. OpenGL and shaders can be 
used to improve rendering

Original issue reported on code.google.com by [email protected] on 30 Nov 2013 at 8:52

runtest does not complete using '-d pgm'

What steps will reproduce the problem?
1. xpost -d pgm
2. runtest
3.

What is the expected output? What do you see instead?

There are some errors about bad memory access on one of the later pages, and 
then the fat curves page errors-out.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 5 Jan 2014 at 11:22

Increase array and string max size

Currently, xpost does not allocate an ent number for zero-sized array. And it uses a 16bit field for sizes of array and string objects. The underlying memory system can handle 32bit sizes.

So, we can interpret size=0 to be size=0x10000 iff the ent is not 0. This increases the maximum size of strings and arrays and dicts to 65536.

Scanner bug. Unterminated string returns file contents up to EOF with no syntaxerror.

What steps will reproduce the problem?
1. (... EOF
2.
3.

What is the expected output? What do you see instead?

An open paren that is not followed by a close paren before EOF
should result in a syntaxerror. Observed result is a valid string 
object and no error message.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 7 Dec 2013 at 7:21

color space not changing naturally

After selecting the rgb color space like:
0 0 1 setrgbcolor
then 0 setgray does not select black and change the space back to gray.

Instead one must specify rgb black to get black:
0 0 0 setrgbcolor

Bug in the scanner with proc delimiter in string

What steps will reproduce the problem?
1. {(})}
2.
3.

What is the expected output? What do you see instead?

It should construct a procedure containing a string containing
the single right-curly-brace character.

Instead, there is an /undefined error and an empty procedure
is left on the stack.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 2 Dec 2013 at 8:56

PS interpreter

Hi, my name is Ivan and I am making my own PS interpreter.

I ignored PS spec for a while and made my "own solution" for some features. E.g. I have no execution stack. I have so-called "token stack" TS. Interpreter takes tokens from TS, when there are any, and from a file, when TS is empty.

To "call a procedure", I just put its tokens into TS. To do a FOR loop, I put its body into TS N-times (with the value of iterating variable in between).

I am having problems, when the loop body terminates prematurely. I also can't implement "loop" operator.

What is the right way to implement Execution stack? For some operators (mainly loops, or colorimage) you need to switch between that operator and executing the procedure multiple times. Do you store the execution state of that operator somehow? What is the most "clean" way to do it?

Thank you and happy new year! Ivan

Scanner Bug: / = reads as one name " ="

What steps will reproduce the problem?
1. / = exec
2.
3.

What is the expected output? What do you see instead?

Should read as the empty literal name "/" and the executable name "=", which 
should print a newline to stdout.

Instead it triggers an /undefined error.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 28 Feb 2014 at 1:11

create a smaller, scaled window if the screen size doesn't support the default dimensions.

What steps will reproduce the problem?
1. Running xpost in VirtualBox Ubuntu
2. 612x792 window doesn't fit in 800x600
3.

What is the expected output? What do you see instead?

If the screen doesn't support the requested dimensions, xpost should
create a smaller window of the correct proportions. We can use the
device's default matrix to compensate, so the ps program still sees
612x792.

May need to adjust fillpoly to ensure that narrow lines are still 
visible. 0-width will still bypass to a single-pixel line. But lines
of width 1 may disappear with the current polygon fill algo.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 17 Dec 2013 at 7:50

readhexstring has multiple problems

Unfortunately, readhexstring just doesn't work. It will fail any test you throw at it.

I have a lot of sympathy for this bug. The main problem is one of those blatant issues that's ridiculously hard to spot until you end up tracing the code line by line and see it go the wrong way at a branch. Even knowing readhexstring wasn't working, I stared at this code for over an hour and I couldn't see the problem.

readhexstring is supposed to skip non-hex characters and process only hex characters. The loops that do this look like:

        do
        {
            c[0] = xpost_file_getc(f);
            if (c[0] == EOF) ++eof;
        } while(!eof && strchr(hex, c[0]) != NULL);

The variable hex correctly contains all upper and lower case hex digits.

Ignoring the end of file handling (which I'll get to in a sec), this simplifies to:

        do
        {
            c[0] = xpost_file_getc(f);
        } while(strchr(hex, c[0]) != NULL);

strchr returns non-NULL if its second argument (a character) is contained in its first argument (a string). So this loop will keep looping as long as the character being read is a hex digit and will exit only when it reads a non-hex digit. This is exactly the reverse of what the test should be.

Flipping the != to == fixes the core problem, but there are others: the end of file handling has a couple of bugs too.

The first is that if we hit end of file between characters (that is, between pairs of hex digits) we'll always return one character too many.

There are no early exits (break, goto or return) in the main for loop. So, if we're not already at end of file at the start of the loop then we're guaranteed to hit the line that writes to s[n] and the loop increment (n++). This will happen even if we hit end of file before reading a hex digit into c[0].

It's easiest to see this by considering the case where readhexstring is called when we're already at the end of the file (although we don't know that yet as we haven't read the EOF character). Before the for loop, eof is initialised to 0 which guarantees the for loop will be run at least once and thus we'll return a single character string. Here's a simplification of the code for that case:

    int eof = 0;
    …
    for (n = 0; !eof && n < S.comp_.sz; n++)
    {
        do  { … no gotos … } while(!eof && …);              [exit do-while loop if we get to EOF but stay in for]
        if (!eof)
            … not taken if we're now at EOF …
        else
        {
            c[1] = '0';
        }
        s[n] = ((strchr(hex, toupper(c[0])) - hex) << 4)    [c[0] is EOF so we calculate NULL - hex]
             | (strchr(hex, toupper(c[1])) - hex);
    }                                                       [and we'll execute the n++ in the for before exiting]
    S.comp_.sz = n;                                         [so, we'll set .sz to 1]

The second end of file issue is that the logic for handling end of file between the first and second hex digits is wrong. It looks like the code is trying to pad the string with a '0' if there are an odd number of hex digits. Although this is the right behaviour for hex string literals (such as <901fa>) it doesn't appear to be correct for readhexstring. Even if this were the right behaviour, the logic is wrong. The code sets the second digit (c[1]) to '0' if end of file was encountered when reading the first digit (c[0]), when it should be doing it if the first digit was read normally (no end of file) but end of file was encountered when reading the second digit.

A simple test is:

{currentfile 3 string readhexstring exch print not {exit} if} loop
54657374696e670a

This should output "Testing\n"

Here are Try it online! links for that test, for xpost (which fails) and Ghostscript (which passes). Both these links run the output through od -c so that non-printable characters are clearly visible.

I've attached a more complex test with more non-hex characters. I've had to give it a .txt extension for upload to GitHub:
readhexstring.txt. You'll need to add another test for input with an odd number of hex digits.

Increase performance of stack and memory-table algorithms

What steps will reproduce the problem?
1. All computation
2. Is slower than it ought to
3. bbbbbb eeeeeee .......

Both the stacks and the memory tables are designed as a linear chain of 
segments. 

Adding a new element to the collection involves traversing the chain to find 
the top segment, and for the tables at least, the 'top' index of the top 
segment from which to calculate an absolute index. Performance would likely 
improve (subject to measure) by caching the address of this topmost table in 
the "head" segment. And also cache the top-segment's 'top' index and current 
number of segments to quickly calculate indices.

If the stack is indexed from the bottom, the (necessary?) linear search from 
below going straight to the element. But indexing from above must first search 
the entire stack to produce a count in order to perform the bottom-up search. 
The count property of the stack, could be made much cheaper by caching the 
value in the "head" segment.

Indexing from the top might also make use of the top-segment address and top 
index to avoid linear searching on the top elements (up to a segment size). For 
more consistent application of this shortcut (at least 1 segment size, up to 2 
segment sizes), we could also cache the 2nd-topmost segment address. 

Original issue reported on code.google.com by luser.droog on 1 Dec 2013 at 12:40

Bug in device base class's buffer implementation

What steps will reproduce the problem?
1. buffer is implemented as ps arrays
2. array contents are subject to save/restore
3. thus, buffer contents are modified by save/restore

What is the expected output? What do you see instead?

save/restore resets the contents of all arrays and dictionaries. The raster 
output of the device should be immune to these effects.

Therefore the buffers should be implemented as strings. Best as 1 single string 
accessed by an array of substrings. Thus the "array contents" do not "change" 
and restore won't affect anything, and the string contents are immune to 
save/restore naturally.

This change will affect data/pgmimage.ps data/ppmimage.ps and 
src/lib/xpost_dev_bgr.c 

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 13 Oct 2014 at 7:59

8 Digit real precision

What steps will reproduce the problem?
1.
2.
3. http://www.tinaja.com/glib/ps8dprp1.pdf

What is the expected output? What do you see instead?

Document describes a technique for getting 8 decimal digits
out of a 32-bit IEEE 754 float in a postscript environment.

Xpost uses a custom C procedure to implement number-to-string
conversions, and could adopt these techniques internally.

Please use labels and text to provide additional information.


Original issue reported on code.google.com by luser.droog on 7 Apr 2014 at 4:58

run with error:xpost_interpreter.c:688 _onerror() cannot load

I just ./configure; make; make install, then run with xpost, and get some error massages: " ERR: src/lib/xpost_interpreter.c:688 _onerror() cannot load $error dict for error: undefinedfilename"
Is there any wrong with my installation step???

-Wall has a new nuisance warning

I think we should add -Wno-cast-function-type to the CFLAGS but I forget where to do it.

I looked at configure.ac and Makefile.am and various Makefile.mk files but I didn't see other warning flags.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.