MCPcopy Create free account
hub / github.com/OpenPrinting/cups / scan_ps

Function scan_ps

cups/raster-interpret.c:1040–1406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1038 */
1039
1040static _cups_ps_obj_t * /* O - New object or NULL on EOF */
1041scan_ps(_cups_ps_stack_t *st, /* I - Stack */
1042 char **ptr) /* IO - String pointer */
1043{
1044 _cups_ps_obj_t obj; /* Current object */
1045 char *start, /* Start of object */
1046 *cur, /* Current position */
1047 *valptr, /* Pointer into value string */
1048 *valend; /* End of value string */
1049 int parens, /* Parenthesis nesting level */
1050 base; /* Numeric base for strtol() */
1051
1052
1053 if (!*ptr)
1054 return (NULL);
1055 /*
1056 * Skip leading whitespace...
1057 */
1058
1059 for (cur = *ptr; *cur; cur ++)
1060 {
1061 if (*cur == '%')
1062 {
1063 /*
1064 * Comment, skip to end of line...
1065 */
1066
1067 for (cur ++; *cur && *cur != '\n' && *cur != '\r'; cur ++);
1068
1069 if (!*cur)
1070 cur --;
1071 }
1072 else if (!isspace(*cur & 255))
1073 break;
1074 }
1075
1076 if (!*cur)
1077 {
1078 *ptr = NULL;
1079
1080 return (NULL);
1081 }
1082
1083 /*
1084 * See what we have...
1085 */
1086
1087 memset(&obj, 0, sizeof(obj));
1088
1089 switch (*cur)
1090 {
1091 case '(' : /* (string) */
1092 obj.type = CUPS_PS_STRING;
1093 start = cur;
1094
1095 for (cur ++, parens = 1, valptr = obj.value.string,
1096 valend = obj.value.string + sizeof(obj.value.string) - 1;
1097 *cur;

Callers 1

_cupsRasterExecPSFunction · 0.85

Calls 2

_cupsStrScandFunction · 0.85
push_stackFunction · 0.85

Tested by

no test coverage detected