⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 objects.c

📁 source code: Covert TXT to PDF
💻 C
📖 第 1 页 / 共 3 页
字号:
       else if (!strcmp(name, "PROCESSHINTS"))               ProcessHints = value;        else if (!strcmp(name, "SAVEFONTPATHS"))               SaveFontPaths = value;        else if (!strcmp(name, "CRASTERCOMPRESSIONTYPE"))               CRASTERCompressionType = value;        else if (!strcmp(name, "CRASHONUSERERROR"))               MustCrash = value;        else if (!strcmp(name, "DEBUG"))               StrokeDebug = SpaceDebug = PathDebug = ConicDebug = LineDebug =                          RegionDebug = MemoryDebug = FontDebug =                          HintDebug = ImageDebug = OffPageDebug = value;        else if (!strcmp(name, "CONICDEBUG"))               ConicDebug = value;        else if (!strcmp(name, "LINEDEBUG"))               LineDebug = value;        else if (!strcmp(name, "REGIONDEBUG"))               RegionDebug = value;        else if (!strcmp(name, "PATHDEBUG"))               PathDebug = value;        else if (!strcmp(name, "SPACEDEBUG"))               SpaceDebug = value;        else if (!strcmp(name, "STROKEDEBUG"))               StrokeDebug = value;        else if (!strcmp(name, "MEMORYDEBUG"))               MemoryDebug = value;        else if (!strcmp(name, "FONTDEBUG"))               FontDebug = value;        else if (!strcmp(name, "HINTDEBUG"))               HintDebug = value;        else if (!strcmp(name, "IMAGEDEBUG"))               ImageDebug = value;        else if (!strcmp(name, "OFFPAGEDEBUG"))               OffPageDebug = value; #ifdef  MC68000/*The following pragmatics flag turns on or off instruction histogramingfor performance analysis.  It is only defined in the Delta cardenvironment.*/       else if (!strcmp(name, "PROFILE")) {               if (value)                       StartProfile();               else                       StopProfile();       }#endif       /* GimeSpace() is define as false ... */       /*       else if (!strcmp(name, "FLUSHCACHE")) {               while (GimeSpace()) { ; }       }       */       else if (!strcmp(name, "CACHEDCHARS"))               CachedChars = (value <= 0) ? 1 : value;        else if (!strcmp(name, "CACHEDFONTS"))               CachedFonts = (value <= 0) ? 1 : value;        else if (!strcmp(name, "CACHEBLIMIT"))               CacheBLimit = value;        else if (!strcmp(name, "CONTINUITY"))               Continuity = value;         else {               printf("Pragmatics flag = '%s'\n", name);               ArgErr("Pragmatics:  flag not known", NULL, NULL);       }       return;} /*:h3.Consume() - Consume a List of Arguments This general purpose routine is provided in the case where the objecttype(s) to be consumed are unknown or not yet verified, and/or it isnot known whether the object is permanent. If the type of the argument is known, it is faster to directly consumethat type, for example, ConsumeRegion() or ConsumePath().  Furthermore,if it is already known that the object is temporary, it is faster tojust kill it rather than consume it, for example, KillSpace().*/ void Consume(n, obj1, obj2, obj3) /* non-ANSI avoids overly strict type checking */       int n;       struct xobject *obj1,*obj2,*obj3;{       switch(n) {            case 0:               return;            case 1:               if (obj1 != NULL && !ISPERMANENT(obj1->flag))                       Destroy(obj1);               return;            case 2:               if (obj1 != NULL && !ISPERMANENT(obj1->flag))                       Destroy(obj1);               if (obj2 != NULL && !ISPERMANENT(obj2->flag))                       Destroy(obj2);               return;            case 3:               if (obj1 != NULL && !ISPERMANENT(obj1->flag))                       Destroy(obj1);               if (obj2 != NULL && !ISPERMANENT(obj2->flag))                       Destroy(obj2);               if (obj3 != NULL && !ISPERMANENT(obj3->flag))                       Destroy(obj3);               return;            default:               abort("Consume:  too many objects", 19);       }}/*:h3.TypeErr() - Handles "Invalid Object Type" Errors*/ struct xobject *TypeErr(name, obj, expect, ret) /* non-ANSI avoids overly strict type checking */       char *name;           /* Name of routine (for error message)          */       struct xobject *obj;  /* Object in error                              */       int expect;           /* type expected                                */       struct xobject *ret;  /* object to return to caller                   */{       static char typemsg[80];        if (MustCrash)               LineIOTrace = TRUE;        sprintf(typemsg, "Wrong object type in %s; expected %s, found %s.\n",                  name, TypeFmt(expect), TypeFmt(obj->type));       IfTrace0(TRUE,typemsg);        ObjectPostMortem(obj);        if (MustCrash)               abort("Terminating because of CrashOnUserError...", 20);       else               ErrorMessage = typemsg; /* changed ISPERMANENT to ret->references > 1 3-26-91 PNM */       if (ret != NULL && (ret->references > 1))               ret = Dup(ret);       return(ret);} /*:h4.TypeFmt() - Returns Pointer to English Name of Object Type This is a subroutine of TypeErr().*/ static char *TypeFmt(type)       int type;             /* type field                                   */{       char *r;        if (ISPATHTYPE(type))               if (type == TEXTTYPE)                       r = "path or region (from TextPath)";               else                       r = "path";       else {               switch (type) {                   case INVALIDTYPE:                       r = "INVALID (previously consumed?)";                       break;                   case REGIONTYPE:                       r = "region";                       break;                   case SPACETYPE:                       r = "XYspace";                       break;                   case LINESTYLETYPE:                       r = "linestyle";                       break;                   case FONTTYPE:                       r = "font";                       break;                   case PICTURETYPE:                       r = "picture";                       break;                   case STROKEPATHTYPE:                       r = "path (from StrokePath)";                       break;                   default:                       r = "UNKNOWN";                       break;               }       }       return(r);}/*:h4.ObjectPostMortem() - Prints as Much as We Can About a Bad Object This is a subroutine of TypeErr() and ArgErr().*/ /*ARGSUSED*/static int ObjectPostMortem(obj) /* non-ANSI avoids overly strict type checking  */       register struct xobject *obj;{        Pragmatics("Debug", 10);       IfTrace2(TRUE,"Bad object is of %s type %p\n", TypeFmt(obj->type), obj);        IfTrace0((obj == (struct xobject *) USER),                  "Suspect that InitImager() was omitted.\n");       Pragmatics("Debug", 0);       /* We return a value to make ANSI-compiler happy */       return(0);       } /*:h3.ArgErr() - Invalid Argument Passed to a Routine A common routine to report argument errors.  It is usually calledis returned to the caller in case MustCrash is FALSE and ArgErrreturns to its caller.*/ struct xobject *ArgErr(string, obj, ret) /* non-ANSI avoids overly strict type checking */       char *string;         /* description of error                         */       struct xobject *obj;  /* object, if any, that was in error            */       struct xobject *ret;  /* object returned to caller or NULL            */{       if (MustCrash)               LineIOTrace = TRUE;       IfTrace1(TRUE,"ARGUMENT ERROR-- %s.\n", string);       if (obj != NULL)               ObjectPostMortem(obj);       if (MustCrash)               abort("Terminating because of CrashOnUserError...", 21);       else               ErrorMessage = string;       return(ret);} /*:h3.abort() - Crash Due to Error We divide by zero, and if that doesn't work, call exit(), the results ofwhich is system dependent (and thus is part of the Hourglass requiredenvironment).*//* RMz: We now do a longjmp in order to be able to recover from the error */ /*ARGSUSED*/void abort(string, no)       char *string;       int no;{    LineIOTrace = TRUE;  TraceClose();  longjmp( stck_state, no);}/* By RMz: Return the abort string to t1lib! */char *t1_get_abort_message( int number){  static char *err_msgs[]={    "DLdiv:  dividend too large", /* 1 */    "divide algorithm error", /* 2 */    "Beziers this big not yet supported", /* 3 */    "ComputeHint: invalid orientation", /* 4 */    "ComputeHint: invalid hinttype", /* 5 */    "ComputeHint: invalid orientation", /* 6 */    "ProcessHint: invalid label", /* 7 */    "ProcessHint: label is not in use", /* 8  */    "ProcessHint: invalid label", /* 9 */    "ProcessHint: invalid adjusttype", /* 10 */    "bad subpath chain", /* 11 */    "ImpliedHorizontalLine:  why ask?", /* 12 */    "disjoint subpath?", /* 13 */    "unable to fix subpath break?", /* 14 */    "Non-positive allocate?", /* 15 */    "We have REALLY run out of memory", /* 16 */    "Free of already freed object?", /* 17 */    "Pragmatics name too large", /* 18 */    "Consume:  too many objects", /* 19 */    "Terminating because of CrashOnUserError...", /* 20 */    "Terminating because of CrashOnUserError...", /* 21 */    "Fundamental TYPE1IMAGER assumptions invalid in this port", /* 22 */    "Reverse: bad path segment", /* 23 */    "UnClose:  no LASTCLOSED", /* 24 */    "PathTransform:  invalid segment", /* 25 */    "QueryPath: unknown segment", /* 26 */    "QueryBounds: unknown type", /* 27 */    "KillRegion:  negative reference count", /* 28 */    "newedge: height not positive", /* 29 */    "Interior: path type error", /* 30 */    "Unwind:  uneven edges", /* 31 */    "negative sized edge?", /* 32 */    "splitedge: above top of list", /* 33 */    "splitedge: would be null", /* 34 */    "null splitedge", /* 35 */    "vertjoin not disjoint", /* 36 */    "SwathUnion:  0 height swath?", /* 37 */    "discard():  ran off end", /* 38 */    "UnJumble:  unpaired edge?", /* 39 */    "Tighten: existing edge bound was bad", /* 40  */    "Tighten: existing region bound was bad", /* 41 */    "EDGE ERROR: non EDGETYPE in list", /* 42 */    "EDGE ERROR: overlapping swaths", /* 43 */    "Context:  QueryDeviceState didn't work", /* 44 */    "QueryDeviceState returned invalid orientation", /* 45 */    "Context:  out of them", /* 46 */    "MatrixInvert:  can't", /* 47 */    "xiStub called", /* 48 */    "Illegal access type1 abort() message" /* 49 */  };  /* no is valid from 1 to 48 */  if ( (number<1)||(number>48))    number=49;  return( err_msgs[number-1]);    }/*:h3.REAL Miscellaneous Stuff :h4.ErrorMsg() - Return the User an Error Message*/ char *ErrorMsg(){       register char *r;        r = ErrorMessage;       ErrorMessage = NULL;       return(r);} /*:h4.InitImager() - Initialize TYPE1IMAGER We check that a short is 16 bits and a long 32 bits; we have madethose assumptions elsewhere in the code.  (This is almost a C standard,anyway.)  Note that TYPE1IMAGER makes no assumptions about the size of an'int'!:i1/portability assumptions/*/void InitImager(){ /* Check to see if we have been using our own malloc.  If so,*//* Undef malloc so that we can get to the system call. *//* All other calls to malloc are defined to Xalloc.  */        if (sizeof(SHORT) != 2 || sizeof(LONG) != 4)          abort("Fundamental TYPE1IMAGER assumptions invalid in this port", 22);       InitSpaces();       InitFonts();       InitFiles();/*In some environments, constants and/or exception handling need to be*/       LibInit();}/*:h4.TermImager() - Terminate TYPE1IMAGER This only makes sense in a server environment; true TYPE1IMAGER needs donothing.*/void TermImager(){       return;}/*:h4.reportusage() - A Stub to Get a Clean Link with Portable PMP*/void reportusage( void){       return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -