static void image_ttf_face_names(INT32 args) { int n,i; int has[8]={0,0,0,0,0,0,0,0}; /* iso8859=20, unicode=30, any=1 */ char *hasname[8]={"copyright","family","style","full", "expose","version","postscript","trademark"}; struct array *a,*b; image_ttf_face__names(args); if (sp[-1].type!=T_ARRAY) Pike_error("Image.TTF.Face->names(): internal error, weird _names()\n"); a=sp[-1].u.array; n=0; for (i=0; i<a->size; i++) { int ihas=1; int what; b=a->item[i].u.array; what=b->item[3].u.integer; if (what>=8 || what<0) continue; /* weird */ switch (b->item[0].u.integer*100+b->item[1].u.integer) { case 301: /* M$: unicode */ case 300: /* M$: unicode (?) */ ihas=30; break; case 202: /* ISO: iso-8859-1 */ ihas=20; break; } if (ihas<has[what]) continue; /* worse */ push_text(hasname[what]); if (ihas==30) /* unicode, M$ but weird enough correct byteorder */ { ptrdiff_t n = b->item[4].u.string->len/2; struct pike_string *ps=begin_wide_shared_string(n,1); p_wchar1 *d=STR1(ps); p_wchar0 *s=STR0(b->item[4].u.string); while (n--) *(d++)=((p_wchar1)s[0]<<8)|(p_wchar1)s[1],s+=2; push_string(end_shared_string(ps)); } else push_svalue(b->item+4); n++; } f_aggregate_mapping(n*2); stack_swap(); pop_stack(); }
*! __REAL_MINOR__, __REAL_BUILD__); *! @endcode *! *! @seealso *! @[__VERSION__], @[__MINOR__], @[__BUILD__], *! @[__REAL_VERSION__], @[__REAL_MINOR__], @[__REAL_BUILD__], */ PMOD_EXPORT void f_version(INT32 args) { pop_n_elems(args); push_static_text ("Pike v" DEFINETOSTR (PIKE_MAJOR_VERSION) "." DEFINETOSTR (PIKE_MINOR_VERSION) " release " DEFINETOSTR (PIKE_BUILD_VERSION)); } void push_compact_version(void) { push_constant_string_code (str, { p_wchar2 *wstr; str = begin_wide_shared_string (3, 2); wstr = STR2(str); wstr[0] = PIKE_MAJOR_VERSION; wstr[1] = PIKE_MINOR_VERSION; wstr[2] = PIKE_BUILD_VERSION; str = end_shared_string (str); }); }
INT32 assemble(int store_linenumbers) { INT32 entry_point; INT32 max_label=-1,tmp; INT32 *labels, *jumps, *uses, *aliases; ptrdiff_t e, length; p_instr *c; #ifdef PIKE_PORTABLE_BYTECODE struct pike_string *tripples = NULL; #endif /* PIKE_PORTABLE_BYTECODE */ #ifdef PIKE_DEBUG INT32 max_pointer=-1; int synch_depth = 0; size_t fun_start = Pike_compiler->new_program->num_program; #endif int relabel; int reoptimize = relabel = !(debug_options & NO_PEEP_OPTIMIZING); c=(p_instr *)instrbuf.s.str; length=instrbuf.s.len / sizeof(p_instr); #ifdef PIKE_DEBUG if((a_flag > 1 && store_linenumbers) || a_flag > 2) { for (e = 0; e < length; e++) { if (c[e].opcode == F_POP_SYNCH_MARK) synch_depth--; fprintf(stderr, "~~~%4d %4lx %*s", c[e].line, DO_NOT_WARN((unsigned long)e), synch_depth, ""); dump_instr(c+e); fprintf(stderr,"\n"); if (c[e].opcode == F_SYNCH_MARK) synch_depth++; } if (synch_depth) { Pike_fatal("Unbalanced sync_mark/pop_sync_mark: %d\n", synch_depth); } } #endif #ifdef PIKE_PORTABLE_BYTECODE /* No need to do this for constant evaluations. */ if (store_linenumbers) { p_wchar2 *current_tripple; struct pike_string *previous_file = NULL; int previous_line = 0; ptrdiff_t num_linedirectives = 0; /* Count the number of F_FILENAME/F_LINE pseudo-ops we need to add. */ for (e=0; e < length; e++) { if (c[e].file != previous_file) { previous_file = dmalloc_touch_named(struct pike_string *, c[e].file, "prev_file"); num_linedirectives++; } if (c[e].line != previous_line) { previous_line = c[e].line; num_linedirectives++; } } /* fprintf(stderr, "length:%d directives:%d\n", * length, num_linedirectives); */ if (!(tripples = begin_wide_shared_string(3*(length+num_linedirectives), 2))) { Pike_fatal("Failed to allocate wide string of length %d 3*(%d + %d).\n", 3*(length+num_linedirectives), length, num_linedirectives); } previous_file = NULL; previous_line = 0; current_tripple = STR2(tripples); for (e = 0; e < length; e++) { if (c[e].file != previous_file) { current_tripple[0] = F_FILENAME; current_tripple[1] = store_prog_string(dmalloc_touch_named(struct pike_string *, c[e].file, "store_prog_string")); current_tripple[2] = 0; current_tripple += 3; previous_file = dmalloc_touch_named(struct pike_string *, c[e].file, "prev_file"); } if (c[e].line != previous_line) { current_tripple[0] = F_LINE; current_tripple[1] = c[e].line; current_tripple[2] = 0; current_tripple += 3; previous_line = c[e].line; } current_tripple[0] = c[e].opcode; current_tripple[1] = c[e].arg; current_tripple[2] = c[e].arg2; current_tripple += 3; }