home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / gnu / gcc / bug / 2158 < prev    next >
Encoding:
Text File  |  1992-08-20  |  23.2 KB  |  2,616 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!usc!rpi!uwm.edu!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!monk.sheridanc.on.ca!doug
  3. From: doug@monk.sheridanc.on.ca (Doug Berry)
  4. Subject: gcc 2.2.2 and Ultrix 4.2c on ghostscript2.5
  5. Message-ID: <9208202048.AA03085@monk.sheridanc.on.ca>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Thu, 20 Aug 1992 12:48:44 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 2603
  12.  
  13. I've had a problem with the compiler
  14.  
  15. I made the compiler by doing 
  16.   configure decstation
  17. here's gcc -v
  18. -------------------%<-----------------------
  19. Reading specs from /usr/local/lib/gcc-lib/decstation/2.2.2/specs
  20. gcc version 2.2.2
  21. -------------------%<-----------------------
  22. i was making ghostscript2.5 on a DECstation 5000/25 running
  23. Ultrix 4.2c when...
  24.  
  25. gcc  -g -O  -I/usr/local/lib/gcc-lib/include -c gsmain.c
  26. pid 3074 (cc1) was killed on an unaligned access, at pc 0x46e40c
  27. gcc: Internal compiler error: program cc1 got fatal signal 10
  28. make: *** [gsmain.o] Error 1
  29. -------------------%<-----------------------
  30. here is output from gcc -E -I/usr/local/lib/gcc-lib/include gsmain.c
  31. -------------------%<-----------------------
  32. # 1 "gsmain.c"
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. # 1 "memory_.h" 1
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92. # 57 "memory_.h"
  93.  
  94.  
  95.  
  96.  
  97. # 1 "/usr/include/memory.h" 1 3
  98.  
  99. extern void
  100.     *memccpy(),
  101.     *memchr(),
  102.     *memcpy(),
  103.     *memmove(),
  104.     *memset();
  105. extern int memcmp();
  106. # 61 "memory_.h" 2
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123. extern void memswab2(), memswab4();
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133. extern void memflip8x8();
  134.  
  135. # 22 "gsmain.c" 2
  136.  
  137. # 1 "string_.h" 1
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169. # 1 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/string.h" 1 3
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216. typedef    unsigned int    size_t;         
  217.  
  218.  
  219.  
  220.  
  221.  
  222.         
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231. extern char
  232.     *strcat( char *__s1, const char *__s2 ),    
  233.     *strchr( const char *__s, int __c ),
  234.     *strcpy( char *__s1, const char *__s2 ),
  235.     *strerror( int __n ),        
  236.     *strncat( char *__s1, const char *__s2, size_t __n ),
  237.     *strncpy( char *__s1, const char *__s2, size_t __n ),
  238.     *strpbrk(const char *__s1, const char *__s2 ),    
  239.     *strrchr( const char *__s, int __c ),
  240.     *strstr( const char *__s, const char *__t ),
  241.     *strtok( char *__s1, const char *__s2 );    
  242.  
  243. extern int
  244.     memcmp( const void *__s1, const void *__s2, size_t __n ),
  245.     strcmp( const char *__s1, const char *__s2 ),
  246.     strcoll( const char *__s1, const char *__s2 ),
  247.     strncmp( const char *__s1, const char *__s2, size_t __n );
  248.  
  249. extern void
  250.     *memchr( const void *__s, int __c, size_t __n ),    
  251.     *memcpy( void *__s1, const void *__s2, size_t __n ),
  252.     *memmove( void *__s1, const void *__s2, size_t __n ),
  253.     *memset( void *__s, int __c, size_t __n );
  254.  
  255. extern size_t
  256.     strcspn( const char *__s1, const char *__s2 ),
  257.     strlen( const char *__s ),
  258.     strspn( const char *__s1, const char *__s2 ),
  259.     strxfrm( char *__to, const char *__from, size_t __maxsize  );
  260.  
  261. # 125 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/string.h" 3
  262.  
  263. # 32 "string_.h" 2
  264.  
  265.  
  266.  
  267. # 23 "gsmain.c" 2
  268.  
  269. # 1 "ghost.h" 1
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291. # 1 "gx.h" 1
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313. # 1 "gs.h" 1
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335. # 1 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/stdio.h" 1 3
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424. # 1 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/ansi_compat.h" 1 3
  425.  
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469. # 116 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/ansi_compat.h" 3
  470.  
  471. # 89 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/stdio.h" 2 3
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.              
  486.  
  487.  
  488.  
  489.  
  490. extern    struct    _iobuf {
  491.     int    _cnt;
  492.     char    *_ptr;
  493.     char    *_base;
  494.     int    _bufsiz;
  495.     short    _flag;
  496.     short    _file;
  497. } _iob[3 ];
  498. typedef    struct _iobuf    FILE;
  499.  
  500. typedef    long    fpos_t;
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.         
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531. extern int     getc( FILE *__stream );
  532. extern int    getchar( void );
  533. extern int    putc( int __c, FILE *__stream);
  534. extern int    putchar( int __c);
  535. extern int    feof( FILE *__stream );
  536. extern int    ferror( FILE *__stream );
  537. extern int    fileno( FILE *__stream );
  538. extern int    _filbuf( FILE *p);
  539. extern int    _flsbuf( unsigned char x , FILE *p);
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556. typedef char *va_list;
  557.  
  558.  
  559.  
  560.  
  561.  
  562. extern void    clearerr( FILE *__stream); 
  563. extern int    fclose( FILE *__stream );
  564. extern FILE *    fdopen( int __filedes, char *__type );
  565. extern int    fflush( FILE *__stream );
  566. extern int    fgetc( FILE *__stream );
  567. extern int    fgetpos( FILE *__stream, fpos_t *__pos );
  568. extern char *    fgets( char *__s, int __n, FILE *__stream );
  569. extern FILE *    fopen( const char *__filename, const char *__type );
  570. extern int    fprintf( FILE *__stream, const char *__format, ... );
  571. extern int    fputc( int __c, FILE *__stream );
  572. extern int    fputs( const char *__s, FILE *__stream );
  573. extern size_t    fread( void *__ptr, size_t __size,
  574.             size_t __nitems, FILE *__stream ); 
  575. extern FILE *    freopen( const char *__filename, const char *__type,
  576.             FILE *__stream );
  577. extern int    fscanf( FILE *__stream, const char *__format, ... );
  578. extern int    fseek( FILE *__stream, long __offset, int __ptrname );
  579. extern int    fsetpos( FILE *__stream, const fpos_t *__pos );
  580. extern long    ftell( FILE *__stream );
  581. extern size_t    fwrite( const void *__ptr, size_t __size,
  582.             size_t __nitems, FILE *__stream );
  583. extern char *    gets( char *__s );    
  584. extern void    perror( const char *__s );
  585. extern FILE  *    popen(const char *__command, const char *__type );
  586. extern int    printf( const char *__format, ... );    
  587. extern int    puts( const char *__s );    
  588. extern int    remove( const char *__filename );
  589. extern int    rename( const char *__from, const char *__to );
  590. extern void    rewind( FILE *__stream );
  591. extern int    scanf( const char *__format, ... );    
  592. extern void    setbuf( FILE *__stream, char *__buf );
  593. extern int    setvbuf( FILE *__stream, char *__buf,
  594.             int __type, size_t __size );
  595. extern int    sscanf( const char *__s, const char *__format, ... );
  596. extern FILE *    tmpfile( void );    
  597. extern char *    tmpnam( char *__s );
  598. extern int    ungetc( int __c, FILE *__stream );
  599. extern int    vfprintf( FILE *__stream, const char *__format, va_list __ap );
  600. extern int    vprintf( const char *__format, va_list __ap );
  601. extern int    vsprintf( char *__s, const char *__format, va_list __ap);
  602.  
  603.  
  604. extern char *    tempnam( const char *__dir, const char *__pfx);
  605. extern int    putw( int __w, FILE *__stream );
  606. extern int    getw(FILE *__stream);
  607. extern int    pclose( FILE *__stream );
  608.  
  609.  
  610. # 299 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/stdio.h" 3
  611.  
  612.  
  613.  
  614.  
  615. extern int    sprintf( char *__s, const char *__format, ... );
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635. # 22 "gs.h" 2
  636.  
  637. # 1 "std.h" 1
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. # 1 "arch.h" 1
  665.  
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678. # 27 "std.h" 2
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749. typedef unsigned char byte;
  750. typedef unsigned char uchar;
  751. typedef unsigned short ushort;
  752. typedef unsigned int uint;
  753. typedef unsigned long ulong;
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763. # 1 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/sys/types.h" 1 3
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. # 1 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/ansi_compat.h" 1 3
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887. # 116 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/ansi_compat.h" 3
  888.  
  889. # 79 "/usr/local/lib/gcc-lib/decstation/2.2.2/include/sys/types.h" 2 3
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907. typedef    unsigned char    u_char;
  908. typedef    unsigned short    u_short;
  909. typedef    unsigned int    u_int;
  910. typedef    unsigned int    uint_ ;         
  911. typedef    unsigned long    u_long;
  912. typedef    unsigned short    ushort_ ;         
  913.  
  914. typedef    volatile char        v_char;
  915. typedef    volatile short        v_short;
  916. typedef    volatile long        v_long;
  917. typedef    volatile unsigned char    vu_char;
  918. typedef    volatile unsigned short    vu_short;
  919. typedef    volatile unsigned long    vu_long;
  920.  
  921. typedef
  922.  
  923.     signed
  924.  
  925.         char    s_char;
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935. typedef    struct    _physadr { int r[1]; } *physadr;
  936.  
  937.  
  938.  
  939.  
  940. typedef    struct    label_t    {
  941.     int    val[12];
  942. } label_t;
  943.  
  944.  
  945. typedef    struct    _quad { long val[2]; } quad;
  946. typedef    long    daddr_t;
  947. typedef    char *    caddr_t;
  948. typedef u_long    gno_t;
  949. typedef short    cnt_t;             
  950. typedef    long    swblk_t;
  951. typedef long    paddr_t;         
  952. typedef    long    audit_ID_t;
  953.  
  954.  
  955. typedef    short    dev_t;
  956. typedef short    gid_t;             
  957. typedef    unsigned long    ino_t;
  958. typedef unsigned short    mode_t;         
  959. typedef short    nlink_t;         
  960. typedef    int    off_t;
  961.  
  962.  
  963. typedef int    pid_t;             
  964.  
  965. typedef short    uid_t;             
  966.  
  967.  
  968. typedef int    time_t;
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981. typedef int    clock_t;             
  982.  
  983. typedef long    key_t;             
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012. typedef long    fd_mask;
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019. typedef    struct fd_set {
  1020.     fd_mask    fds_bits[(((4096     )+(( (sizeof(fd_mask) * 8        )    )-1))/( (sizeof(fd_mask) * 8        )    )) ];
  1021. } fd_set;
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030. # 111 "std.h" 2
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050. # 138 "std.h"
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058. typedef char *ptr_ord_t;
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088. typedef double floatp;
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118. # 219 "std.h"
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. typedef char *(*proc_alloc_t)(unsigned num_elements, unsigned element_size, const char *client_name );
  1127. typedef void (*proc_free_t)(char *data, unsigned num_elements, unsigned element_size, const char *client_name );
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222. # 23 "gs.h" 2
  1223.  
  1224.  
  1225.  
  1226. extern FILE *gs_stdin, *gs_stdout, *gs_stderr;
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261. typedef struct gs_point_s {
  1262.     double x, y;
  1263. } gs_point;
  1264. typedef struct gs_int_point_s {
  1265.     int x, y;
  1266. } gs_int_point;
  1267.  
  1268.  
  1269.  
  1270.  
  1271. typedef struct gs_rect_s {
  1272.     gs_point p, q;             
  1273. } gs_rect;
  1274. typedef struct gs_int_rect_s {
  1275.     gs_int_point p, q;
  1276. } gs_int_rect;
  1277.  
  1278.  
  1279.  
  1280. typedef struct gs_state_s gs_state;
  1281.  
  1282.  
  1283.  
  1284. typedef struct {
  1285.     proc_alloc_t alloc;
  1286.     proc_free_t free;
  1287. } gs_memory_procs;
  1288.  
  1289.  
  1290. char *gs_malloc(uint, uint, const char * );
  1291. void gs_free(char *, uint, uint, const char * );
  1292. # 22 "gx.h" 2
  1293.  
  1294. # 1 "gdebug.h" 1
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318. extern char gs_debug[128];
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336. # 65 "gdebug.h"
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349. # 23 "gx.h" 2
  1350.  
  1351.  
  1352.  
  1353. extern int gs_log_error(int, const char   *, int );
  1354.  
  1355.  
  1356. # 22 "ghost.h" 2
  1357.  
  1358. # 1 "iref.h" 1
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382. typedef struct ref_s ref;
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388. typedef enum {
  1389.     t_array,             
  1390.     t_boolean,             
  1391.     t_condition,             
  1392.     t_dictionary,             
  1393.     t_file,                 
  1394.     t_fontID,             
  1395.     t_gstate,             
  1396.     t_integer,             
  1397.     t_lock,                 
  1398.     t_mark,                 
  1399.     t_name,                 
  1400.     t_null,                 
  1401.     t_operator,             
  1402.     t_real,                 
  1403.     t_save,                 
  1404.     t_string,             
  1405.  
  1406.     t_mixedarray,             
  1407.     t_shortarray,             
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.     t_device,             
  1416.     t_oparray,             
  1417.     t_next_index         
  1418. } ref_type;
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.                      
  1466.  
  1467.  
  1468.                      
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482. typedef struct dict_s dict;
  1483. typedef struct name_s name;
  1484.  
  1485.  
  1486. typedef int (*dummy_op_proc_p)();
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494. struct stream_s;
  1495. struct gs_font_s;
  1496. struct gs_color_s;
  1497. struct gs_condition_s;
  1498. struct gs_lock_s;
  1499. struct gx_device_s;
  1500. struct gstate_obj_s;
  1501. struct vm_save_s;
  1502. struct tas_s {
  1503.     ushort type_attrs;
  1504.     ushort rsize;
  1505. };
  1506. struct ref_s {
  1507.  
  1508.     struct tas_s tas;
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.     union v {             
  1537.         long intval;
  1538.         ushort index;         
  1539.         float realval;
  1540.         byte *bytes;
  1541.         const byte *const_bytes;
  1542.         struct ref_s *refs;
  1543.         const struct ref_s *const_refs;
  1544.         name *pname;
  1545.         const name *const_pname;
  1546.         dict *pdict;
  1547.         const dict *const_pdict;
  1548.         const ushort   *packed;
  1549.         dummy_op_proc_p opproc;
  1550.         struct stream_s *pfile;
  1551.         struct gs_font_s *pfont;
  1552.         struct gs_condition_s *pcond;
  1553.         struct gs_lock_s *plock;
  1554.         struct gx_device_s *pdevice;
  1555.         struct gs_state_s *pgstate;
  1556.         struct vm_save_s *psave;
  1557.     } value;
  1558. };
  1559. # 23 "ghost.h" 2
  1560.  
  1561. # 24 "gsmain.c" 2
  1562.  
  1563. # 1 "gp.h" 1
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600. extern void gp_init(void );
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606. extern void gp_exit(void );
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614. extern void gp_get_clock(long *pdt );
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626. typedef struct gx_device_s gx_device;
  1627.  
  1628.  
  1629.  
  1630. extern void gp_console_puts(const char *, uint );
  1631.  
  1632.  
  1633. extern int gp_make_console_current(gx_device * );
  1634.  
  1635.  
  1636. extern int gp_make_graphics_current(gx_device * );
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646. extern FILE *gp_open_printer(char *fname );
  1647.  
  1648.  
  1649. extern void gp_close_printer(FILE *pfile, const char *fname );
  1650.  
  1651.  
  1652.  
  1653.  
  1654. extern const char gp_file_name_list_separator;
  1655.  
  1656.  
  1657. extern const char gp_scratch_file_name_prefix[];
  1658.  
  1659.  
  1660. extern const int gp_file_names_ignore_case;
  1661.  
  1662.  
  1663.  
  1664.  
  1665. extern const char gp_fmode_binary_suffix[];
  1666.  
  1667.  
  1668. extern const char gp_fmode_rb[];
  1669. extern const char gp_fmode_wb[];
  1670.  
  1671.  
  1672.  
  1673. extern FILE *gp_open_scratch_file(const char *prefix, char *fname,
  1674.                      const char *mode );
  1675.  
  1676.  
  1677.  
  1678. extern int gp_file_name_is_absolute(const char *fname, uint len );
  1679.  
  1680.  
  1681.  
  1682. extern const char *
  1683.     gp_file_name_concat_string(const char *prefix, uint plen,
  1684.                       const char *fname, uint len );
  1685.  
  1686.  
  1687.  
  1688.  
  1689.  
  1690. typedef struct file_status_s {
  1691.     long size_pages;
  1692.     long size_bytes;
  1693.     long time_referenced;
  1694.     long time_created;
  1695. } file_status;
  1696. extern int gp_file_status(const char *fname, file_status *pstatus );
  1697.  
  1698.  
  1699.  
  1700. struct file_enum_s;     
  1701. typedef struct file_enum_s file_enum;
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713. extern file_enum *gp_enumerate_files_init(const char *pat, uint patlen,
  1714.                          proc_alloc_t palloc,
  1715.                          proc_free_t pfree );
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724. extern uint gp_enumerate_files_next(file_enum *pfen, char *ptr, uint maxlen );
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732. extern void gp_enumerate_files_close(file_enum *pfen );
  1733. # 25 "gsmain.c" 2
  1734.  
  1735. # 1 "gsmatrix.h" 1
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774. struct gs_matrix_s {
  1775.     long _xx  ; float xx;    long _xy  ; float xy;    long _yx  ; float yx;    long _yy  ; float yy;    long _tx  ; float tx;    long _ty  ; float ty ;
  1776. };
  1777.  
  1778.  
  1779. typedef struct gs_matrix_s gs_matrix;
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791. void    gs_make_identity(gs_matrix * );
  1792. int    gs_make_translation(floatp, floatp, gs_matrix * ),
  1793.     gs_make_scaling(floatp, floatp, gs_matrix * ),
  1794.     gs_make_rotation(floatp, gs_matrix * );
  1795.  
  1796.  
  1797. int    gs_matrix_multiply(const gs_matrix *, const gs_matrix *, gs_matrix * ),
  1798.     gs_matrix_invert(const gs_matrix *, gs_matrix * ),
  1799.     gs_matrix_rotate(const gs_matrix *, floatp, gs_matrix * );
  1800.  
  1801.  
  1802. int    gs_point_transform(floatp, floatp, const gs_matrix *, gs_point * ),
  1803.     gs_point_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ),
  1804.     gs_distance_transform(floatp, floatp, const gs_matrix *, gs_point * ),
  1805.     gs_distance_transform_inverse(floatp, floatp, const gs_matrix *, gs_point * ),
  1806.     gs_bbox_transform_inverse(gs_rect *, gs_matrix *, gs_rect * );
  1807.  
  1808.  
  1809. # 26 "gsmain.c" 2
  1810.  
  1811. # 1 "gxdevice.h" 1
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834. # 1 "gxbitmap.h" 1
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866. typedef unsigned long gx_bitmap_id;
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.  
  1880.  
  1881.  
  1882.  
  1883. typedef struct gx_bitmap_s {
  1884.     byte *data;
  1885.     int raster;             
  1886.     gs_int_point size;         
  1887.     gx_bitmap_id id;
  1888.     ushort rep_width, rep_height;     
  1889. } gx_bitmap;
  1890.  
  1891.  
  1892. # 23 "gxdevice.h" 2
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898. typedef unsigned long gx_color_index;
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904. typedef unsigned short gx_color_value;
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915. typedef struct gx_device_color_info_s {
  1916.     int num_components;         
  1917.                      
  1918.     int depth;             
  1919.     gx_color_value max_gray;     
  1920.     gx_color_value max_rgb;         
  1921.                      
  1922.     gx_color_value dither_gray;     
  1923.     gx_color_value dither_rgb;     
  1924.                      
  1925. } gx_device_color_info;
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931. typedef struct gx_device_procs_s gx_device_procs;
  1932.  
  1933.  
  1934.  
  1935. # 76 "gxdevice.h"
  1936.  
  1937.  
  1938. struct gx_device_s {
  1939.     int params_size;    gx_device_procs *procs;    const char *dname;    int width;    int height;    float x_pixels_per_inch;    float y_pixels_per_inch;    float l_margin, b_margin, r_margin, t_margin;    gx_device_color_info color_info;    int is_open            ;
  1940. };
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949. typedef struct gs_prop_item_s gs_prop_item;
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956. struct gx_device_procs_s {
  1957.  
  1958.  
  1959.  
  1960.     int (*open_device)(gx_device *dev ) ;
  1961.  
  1962.  
  1963.  
  1964.     void (*get_initial_matrix)(gx_device *dev, gs_matrix *pmat ) ;
  1965.  
  1966.  
  1967.  
  1968.     int (*sync_output)(gx_device *dev ) ;
  1969.  
  1970.  
  1971.  
  1972.     int (*output_page)(gx_device *dev, int num_copies, int flush ) ;
  1973.  
  1974.  
  1975.  
  1976.     int (*close_device)(gx_device *dev ) ;
  1977.  
  1978.  
  1979.  
  1980.  
  1981.     gx_color_index (*map_rgb_color)(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ) ;
  1982.  
  1983.  
  1984.  
  1985.  
  1986.     int (*map_color_rgb)(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ) ;
  1987.  
  1988.  
  1989.  
  1990.  
  1991.     int (*fill_rectangle)(gx_device *dev, int x, int y, int width, int height, gx_color_index color ) ;
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.     int (*tile_rectangle)(gx_device *dev, const gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ) ;
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.     int (*copy_mono)(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1 ) ;
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.     int (*copy_color)(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ) ;
  2012.  
  2013.  
  2014.  
  2015.  
  2016.     int (*draw_line)(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ) ;
  2017.  
  2018.  
  2019.  
  2020.  
  2021.     int (*get_bits)(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ) ;
  2022.  
  2023.  
  2024.  
  2025.     int (*get_props)(gx_device *dev, gs_prop_item *plist ) ;
  2026.     
  2027.  
  2028.  
  2029.     int (*put_props)(gx_device *dev, gs_prop_item *plist, int count ) ;
  2030.     
  2031. };
  2032.  
  2033.  
  2034.  
  2035. extern unsigned int gx_device_bytes_per_scan_line(const gx_device *dev, int pad_to_word );
  2036.  
  2037.  
  2038.  
  2039. extern int gx_device_adjust_resolution(gx_device *dev, int actual_width, int actual_height );
  2040.  
  2041.  
  2042. int gx_default_open_device(gx_device *dev ) ;
  2043. void gx_default_get_initial_matrix(gx_device *dev, gs_matrix *pmat ) ;
  2044. int gx_default_sync_output(gx_device *dev ) ;
  2045. int gx_default_output_page(gx_device *dev, int num_copies, int flush ) ;
  2046. int gx_default_close_device(gx_device *dev ) ;
  2047. gx_color_index gx_default_map_rgb_color(gx_device *dev, gx_color_value red, gx_color_value green, gx_color_value blue ) ;
  2048. int gx_default_map_color_rgb(gx_device *dev, gx_color_index color, gx_color_value rgb[3] ) ;
  2049. int gx_default_tile_rectangle(gx_device *dev, const gx_bitmap *tile, int x, int y, int width, int height, gx_color_index color0, gx_color_index color1, int phase_x, int phase_y ) ;
  2050. int gx_default_copy_color(gx_device *dev, const unsigned char *data, int data_x, int raster, gx_bitmap_id id, int x, int y, int width, int height ) ;
  2051. int gx_default_draw_line(gx_device *dev, int x0, int y0, int x1, int y1, gx_color_index color ) ;
  2052. int gx_default_get_bits(gx_device *dev, int y, unsigned char *data, unsigned int size, int pad_to_word ) ;
  2053. int gx_default_get_props(gx_device *dev, gs_prop_item *plist ) ;
  2054. int gx_default_put_props(gx_device *dev, gs_prop_item *plist, int count ) ;
  2055. # 27 "gsmain.c" 2
  2056.  
  2057. # 1 "gserrors.h" 1
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098. # 28 "gsmain.c" 2
  2099.  
  2100. # 1 "estack.h" 1
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129. typedef ref   *es_ptr;
  2130. typedef const ref   *const_es_ptr;
  2131. extern es_ptr esbot, esp, estop;
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141. extern es_ptr esfile;
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181. # 29 "gsmain.c" 2
  2182.  
  2183. # 1 "main.h" 1
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207. extern char *gs_lib_env_path;
  2208. extern uint gs_memory_chunk_size;
  2209. extern int gs_user_errors;
  2210.  
  2211.  
  2212. extern    void    gs_init0(FILE *, FILE *, FILE *, int ),
  2213.         gs_init1(void ),
  2214.         gs_init2(void );
  2215. extern    void    gs_add_lib_path(const char * );
  2216.  
  2217.  
  2218.  
  2219.  
  2220. extern    int    gs_run_file(const char *, int, int * ),
  2221.         gs_run_string(const char *, int, int * );
  2222. extern    void    gs_debug_dump_stack(int code );
  2223. extern    void    gs_finit(void ),
  2224.         gs_exit(int );
  2225. # 30 "gsmain.c" 2
  2226.  
  2227. # 1 "ostack.h" 1
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256. typedef ref   *os_ptr;
  2257. typedef const ref   *const_os_ptr;
  2258. extern os_ptr osbot, osp, ostop;
  2259.  
  2260.  
  2261.  
  2262.  
  2263. # 31 "gsmain.c" 2
  2264.  
  2265. # 1 "store.h" 1
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324. # 67 "store.h"
  2325.  
  2326.      
  2327.      
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336. extern int alloc_save_new_mask;         
  2337. extern int alloc_save_test_mask;     
  2338. extern int alloc_save_change(ref *ptr, const char *client_name );
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352. extern ref *alloc_refs(uint num_refs, const char *client_name );
  2353. extern void alloc_free_refs(ref *ptr, uint num_refs, const char *client_name );
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402. # 32 "gsmain.c" 2
  2403.  
  2404.  
  2405.  
  2406.  
  2407. uint gs_memory_chunk_size = 20000;
  2408. int gs_user_errors;
  2409.  
  2410.  
  2411. const char **gs_lib_paths;
  2412. static  int gs_lib_count;
  2413. char *gs_lib_env_path;
  2414.  
  2415.  
  2416.  
  2417. extern const char *gs_lib_default_path;
  2418. extern const char *gs_init_file;
  2419. extern ref gs_init_file_array[];
  2420.  
  2421. extern int gs_log_errors;
  2422. extern FILE *gs_debug_out;
  2423.  
  2424.  
  2425.  
  2426.  
  2427. static  int init1_done, init2_done;
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434. void
  2435. gs_init0(FILE *in, FILE *out, FILE *err, int max_lib_paths)
  2436. {     
  2437.     gs_stdin = in;
  2438.     gs_stdout = out;
  2439.     gs_stderr = err;
  2440.     gs_debug_out = gs_stdout;
  2441.      
  2442.      
  2443.      
  2444.      
  2445.     gp_init();
  2446.      
  2447.     gs_lib_env_path = 0;
  2448.     gs_lib_paths =
  2449.         (const char **)gs_malloc(max_lib_paths + 3, sizeof(char *),
  2450.                      "gs_lib_paths array");
  2451.     gs_lib_count = 0;
  2452.     gs_user_errors = 1;
  2453.     gs_log_errors = 0;
  2454.      
  2455.     memset(gs_debug, 0, 128);
  2456.     init1_done = init2_done = 0;
  2457. }
  2458.  
  2459.  
  2460. void
  2461. gs_init1()
  2462. {    if ( !init1_done )
  2463.        {    alloc_init(gs_malloc, gs_free, gs_memory_chunk_size);
  2464.         { extern void name_init(void ); name_init(); } 
  2465.         { extern void obj_init(void ); obj_init(); }          
  2466.         { extern void scan_init(void ); scan_init(); }          
  2467.         init1_done = 1;
  2468.        }
  2469. }
  2470.  
  2471.  
  2472. void
  2473. gs_init2()
  2474. {    gs_init1();
  2475.     if ( !init2_done )
  2476.        {    int code, exit_code;
  2477.         { extern void gs_init(void ); gs_init(); } 
  2478.         { extern void zop_init(void ); zop_init(); } 
  2479.         interp_init(1);         
  2480.         { extern void op_init(void ); op_init(); }      
  2481.          
  2482.         {    ref *ifp = gs_init_file_array;
  2483.             ref ifa;
  2484.             for ( ; ifp->value.bytes != 0; ifp++ )
  2485.               ((ifp)->tas.rsize = ( strlen((const char *)ifp->value.bytes))) ;
  2486.             (((&ifa)->value. refs = (
  2487.                   gs_init_file_array), ((&ifa)->tas.type_attrs = ((  t_array) << 7 ) + (  (0x10 +0x20 ) )) ) , ((&ifa)->tas.rsize = ( 
  2488.                   ifp - gs_init_file_array)) ) ;
  2489.             initial_enter_name("INITFILES", &ifa);
  2490.         }
  2491.          
  2492.         code = gs_run_file(gs_init_file, gs_user_errors, &exit_code);
  2493.         if ( code < 0 )
  2494.         {    if ( code != (-100)  )
  2495.                 gs_debug_dump_stack(code);
  2496.             gs_exit((exit_code ? exit_code : 2));
  2497.         }
  2498.         init2_done = 1;
  2499.        }
  2500.    }
  2501.  
  2502.  
  2503. void
  2504. gs_add_lib_path(const char *lpath)
  2505. {    gs_lib_paths[gs_lib_count] = lpath;
  2506.     gs_lib_count++;
  2507. }
  2508.  
  2509.  
  2510.  
  2511.  
  2512. static  void
  2513. set_lib_paths()
  2514. {    const char **ppath = &gs_lib_paths[gs_lib_count];
  2515.     if ( gs_lib_env_path != 0 ) *ppath++ = gs_lib_env_path;
  2516.     if ( gs_lib_default_path != 0 ) *ppath++ = gs_lib_default_path;
  2517.     *ppath = 0;
  2518. }
  2519.  
  2520.  
  2521. static  int
  2522. run_open(const char *file_name, ref *pfile)
  2523. {     
  2524.      
  2525.  
  2526.     byte fn[200 ];
  2527.     uint len;
  2528.     return lib_file_open(file_name, strlen(file_name), fn, 200 ,
  2529.                  &len, pfile);
  2530. }
  2531. int
  2532. gs_run_file(const char *file_name, int user_errors, int *pexit_code)
  2533. {    ref initial_file;
  2534.     set_lib_paths();
  2535.     if ( run_open(file_name, &initial_file) < 0 )
  2536.        {    (  fprintf(gs_stderr  , "Can't find initialization file %s\n",  file_name)) ;
  2537.         return gs_log_error((-100) , "gsmain.c", 166)  ;
  2538.        }
  2539.     ((&initial_file)->tas.type_attrs |= ( 0x20  + 0x40 )) ;
  2540.     return gs_interpret(&initial_file, user_errors, pexit_code);
  2541. }
  2542.  
  2543. int
  2544. gs_run_string(const char *str, int user_errors, int *pexit_code)
  2545. {    ref stref;
  2546.     set_lib_paths();
  2547.     (((&stref)->value. const_bytes = ( (byte *)str), ((&stref)->tas.type_attrs = ((  t_string) << 7 ) + (  0x40  + (0x10 +0x20 ) )) ) , ((&stref)->tas.rsize = ( 
  2548.           strlen(str))) ) ;
  2549.     return gs_interpret(&stref, gs_user_errors, pexit_code);
  2550. }
  2551.  
  2552.  
  2553.  
  2554.  
  2555. extern gx_device *gx_device_list[];
  2556. void gs_malloc_release(void );
  2557. void file_close_all(void );
  2558. int gs_closedevice(gx_device * );
  2559. void gp_exit(void );
  2560. void gs_finit()
  2561. {    gx_device **pdev = gx_device_list;
  2562.     fflush(gs_stderr );             
  2563.     for ( ; *pdev != 0; pdev++ )
  2564.       gs_closedevice(*pdev);
  2565.      
  2566.     file_close_all();
  2567.      
  2568.     gs_malloc_release();
  2569.      
  2570.     gp_exit();
  2571. }
  2572. void
  2573. gs_exit(int code)
  2574. {    gs_finit();
  2575.     exit(code);
  2576. }
  2577.  
  2578.  
  2579.  
  2580.  
  2581. extern void debug_print_ref(const ref * );
  2582. extern void debug_dump_refs(const ref *, uint, const char * );
  2583. extern ref error_object;
  2584.  
  2585.  
  2586. void
  2587. gs_debug_dump_stack(int code)
  2588. {    zflush(osp);     
  2589.     fprintf(gs_stderr  , "\nUnexpected interpreter error %d!\nError object: ",  code) ;
  2590.     debug_print_ref(&error_object);
  2591.     fputc('\n', gs_stderr  ) ;
  2592.     debug_dump_refs(osbot, osp + 1 - osbot, "Operand stack");
  2593.     debug_dump_refs(esbot, esp + 1 - esbot, "Execution stack");
  2594. }
  2595.  
  2596.  
  2597. int
  2598. gs_log_error(int err, const char   *file, int line)
  2599. {    if ( gs_log_errors )
  2600.       { if ( file == 0  )
  2601.           fprintf(gs_stderr  , "Returning error %d\n",  err) ;
  2602.         else
  2603.           fprintf(gs_stderr  , "%s(%d): returning error %d\n", 
  2604.                (char *)file,  line,  err) ;
  2605.       }
  2606.     return err;
  2607. }
  2608. -------------------%<-----------------------
  2609.  
  2610. I hope this helps...
  2611. doug
  2612. -- 
  2613.   uucp:  ...utzoo!sis!doug            phone: +1 416 845 9430 x2140
  2614.   else:  doug.berry@sheridanc.on.ca
  2615.  
  2616.