w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

primitive.c
Go to the documentation of this file.
1 /*
2 
3 primitive.w
4 
5 Copyright 2008-2010 Taco Hoekwater <taco@@luatex.org>
6 
7 This file is part of LuaTeX.
8 
9 LuaTeX is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your
12 option) any later version.
13 
14 LuaTeX is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 License for more details.
18 
19 You should have received a copy of the GNU General Public License along
20 with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #include "ptexlib.h"
25 
26 /*tex
27 
28 Control sequences are stored and retrieved by means of a fairly standard hash
29 table algorithm called the method of ``coalescing lists'' (cf.\ Algorithm 6.4C in
30 {\sl The Art of Computer Programming\/}). Once a control sequence enters the
31 table, it is never removed, because there are complicated situations involving
32 \.{\\gdef} where the removal of a control sequence at the end of a group would be
33 a mistake preventable only by the introduction of a complicated reference-count
34 mechanism.
35 
36 The actual sequence of letters forming a control sequence identifier is stored in
37 the |str_pool| array together with all the other strings. An auxiliary array
38 |hash| consists of items with two halfword fields per word. The first of these,
39 called |next(p)|, points to the next identifier belonging to the same coalesced
40 list as the identifier corresponding to~|p|; and the other, called |text(p)|,
41 points to the |str_start| entry for |p|'s identifier. If position~|p| of the hash
42 table is empty, we have |text(p)=0|; if position |p| is either empty or the end
43 of a coalesced hash list, we have |next(p)=0|. An auxiliary pointer variable
44 called |hash_used| is maintained in such a way that all locations |p>=hash_used|
45 are nonempty. The global variable |cs_count| tells how many multiletter control
46 sequences have been defined, if statistics are being kept.
47 
48 A global boolean variable called |no_new_control_sequence| is set to |true|
49 during the time that new hash table entries are forbidden.
50 
51 */
52 
53 /*tex The hash table: */
54 
56 
57 /*tex Allocation pointer for |hash|: */
58 
60 
61 /*tex |hash_extra=hash| above |eqtb_size|: */
62 
64 
65 /*tex Maximum of the hash array: */
66 
68 
69 /*tex Pointer to next high hash location: */
70 
72 
73 /*tex Are new identifiers legal? */
74 
76 
77 /*tex Total number of known identifiers: */
78 
80 
81 /*tex Test if all positions are occupied: */
82 
83 #define hash_is_full (hash_used==hash_base)
84 
85 /*tex
86 
87  \.{\\primitive} support needs a few extra variables and definitions,
88  like:
89 
90 */
91 
92 #define prim_base 1
93 
94 /*tex
95 
96 The arrays |prim| and |prim_eqtb| are used for name -> cmd,chr lookups. The are
97 modelled after |hash| and |eqtb|, except that primitives do not have an
98 |eq_level|, that field is replaced by |origin|.
99 
100 */
101 
102 /*tex Link for coalesced lists: */
103 
104 #define prim_next(a) prim[(a)].lhfield
105 
106 /*tex String number for control sequence name: */
107 
108 #define prim_text(a) prim[(a)].rh
109 
110 /*tex Test if all positions are occupied: */
111 
112 #define prim_is_full (prim_used==prim_base)
113 
114 #define prim_origin_field(a) (a).hh.b1
115 
116 #define prim_eq_type_field(a) (a).hh.b0
117 
118 #define prim_equiv_field(a) (a).hh.rh
119 
120 /*tex Level of definition: */
121 
122 #define prim_origin(a) prim_origin_field(prim_eqtb[(a)])
123 
124 /*tex Command code for equivalent: */
125 
126 #define prim_eq_type(a) prim_eq_type_field(prim_eqtb[(a)])
127 
128 /*tex Equivalent value: */
129 
130 #define prim_equiv(a) prim_equiv_field(prim_eqtb[(a)])
131 
132 /*tex Allocation pointer for |prim|: */
133 
135 
136 /*tex The primitives table: */
137 
138 static two_halves prim[(prim_size + 1)];
139 
141 
142 /*tex
143 
144 The array |prim_data| works the other way around, it is used for cmd,chr -> name
145 lookups.
146 
147 */
148 
149 typedef struct prim_info {
150  /*tex Number of name entries: */
152  /*tex Offset to be used for |chr_code|s: */
154  /*tex Array of names: */
157 
159 
160 /*tex
161 
162 Initialize the memory arrays:
163 
164 */
165 
166 void init_primitives(void)
167 {
168  int k;
169  memset(prim_data, 0, (sizeof(prim_info) * (last_cmd + 1)));
170  memset(prim, 0, (sizeof(two_halves) * (prim_size + 1)));
171  memset(prim_eqtb, 0, (sizeof(memory_word) * (prim_size + 1)));
172  for (k = 0; k <= prim_size; k++) {
174  }
175 }
176 
177 /*tex Nothing is used (yet). */
178 
180 {
182 }
183 
184 
185 /*tex
186 
187 The value of |hash_prime| should be roughly 85\%! of |hash_size|, and it should
188 be a prime number. The theory of hashing tells us to expect fewer than two table
189 probes, on the average, when the search is successful. [See J.~S. Vitter, {\sl
190 Journal of the ACM\/ \bf30} (1983), 231--258.] @^Vitter, Jeffrey Scott@>
191 
192 */
193 
194 static halfword compute_hash(const char *j, unsigned int l, halfword prime_number)
195 {
196  int k;
197  halfword h = (unsigned char) *j;
198  for (k = 1; k <= (int)(l - 1); k++) {
199  h = h + h + (unsigned char) *(j + k);
200  while (h >= prime_number) {
201  h = h - prime_number;
202  }
203  }
204  return h;
205 }
206 
207 /*tex
208 
209 Here is the subroutine that searches the primitive table for an identifier.
210 
211 */
212 
214 {
215  /*tex The hash code: */
216  int h;
217  /*tex The index in the |hash| array: */
218  pointer p;
219  unsigned char *j;
220  unsigned l;
221  if (s < STRING_OFFSET) {
222  p = s;
223  if ((p < 0) || (get_prim_eq_type(p) == undefined_cs_cmd)) {
225  }
226  } else {
227  j = str_string(s);
228  l = (unsigned) str_length(s);
229  h = compute_hash((char *) j, l, prim_prime);
230  /*tex We start searching here; note that |0<=h<hash_prime|. */
231  p = h + prim_base;
232  while (1) {
233  if (prim_text(p) > 0)
234  if (str_length(prim_text(p)) == l)
235  if (str_eq_str(prim_text(p), s))
236  goto FOUND;
237  if (prim_next(p) == 0) {
240  } else {
241  /*tex Insert a new primitive after |p|, then make |p| point to it. */
242  if (prim_text(p) > 0) {
243  do {
244  /*tex Search for an empty location in |prim| */
245  if (prim_is_full) {
246  overflow("primitive size", prim_size);
247  }
248  decr(prim_used);
249  } while (prim_text(prim_used) != 0);
250  prim_next(p) = prim_used;
251  p = prim_used;
252  }
253  prim_text(p) = s;
254  }
255  goto FOUND;
256  }
257  p = prim_next(p);
258  }
259  }
260  FOUND:
261  return p;
262 }
263 
264 /*tex
265 
266 How to test a csname for primitive-ness?
267 
268 */
269 
270 boolean is_primitive(str_number csname)
271 {
272  int n, m;
273  char *ss;
274  m = prim_lookup(csname);
275  ss = makecstring(csname);
276  n = string_lookup(ss, str_length(csname));
277  free(ss);
278  return ((n != undefined_cs_cmd) && (m != undefined_primitive) &&
279  (eq_type(n) == prim_eq_type(m)) && (equiv(n) == prim_equiv(m)));
280 }
281 
282 
283 /*tex
284 
285 A few simple accessors.
286 
287 */
288 
290 {
291  return prim_eq_type(p);
292 }
293 
295 {
296  return prim_origin(p);
297 }
298 
300 {
301  return prim_equiv(p);
302 }
303 
305 {
306  return prim_text(p);
307 }
308 
309 
310 /*tex
311 
312 Dumping and undumping.
313 
314 */
315 
316 void dump_primitives(void)
317 {
318  int p, q;
319  for (p = 0; p <= prim_size; p++) {
320  dump_hh(prim[p]);
321  }
322  for (p = 0; p <= prim_size; p++) {
323  dump_wd(prim_eqtb[p]);
324  }
325  for (p = 0; p <= last_cmd; p++) {
327  dump_int(prim_data[p].subids);
328  for (q = 0; q < prim_data[p].subids; q++) {
330  }
331  }
332 }
333 
335 {
336  int p, q;
337  for (p = 0; p <= prim_size; p++) {
338  undump_hh(prim[p]);
339  }
340  for (p = 0; p <= prim_size; p++) {
342  }
343  for (p = 0; p <= last_cmd; p++) {
345  undump_int(prim_data[p].subids);
346  if (prim_data[p].subids > 0) {
347  prim_data[p].names = (str_number *) xmalloc((unsigned) ((unsigned) prim_data[p].subids * sizeof(str_number *)));
348  for (q = 0; q < prim_data[p].subids; q++) {
350  }
351  }
352  }
353 }
354 
355 /*tex
356 
357 We need to put \TeX's ``primitive'' control sequences into the hash table,
358 together with their command code (which will be the |eq_type|) and an operand
359 (which will be the |equiv|). The |primitive| procedure does this, in a way that
360 no \TeX\ user can. The global value |cur_val| contains the new |eqtb| pointer
361 after |primitive| has acted.
362 
363 Because the definitions of the actual user-accessible name of a primitive can be
364 postponed until runtime, the function |primitive_def| is needed that does nothing
365 except creating the control sequence name.
366 
367 */
368 
369 void primitive_def(const char *s, size_t l, quarterword c, halfword o)
370 {
371  int nncs = no_new_control_sequence;
372  no_new_control_sequence = false;
373  /*tex This creates the |text()| string: */
374  cur_val = string_lookup(s, l);
377  eq_type(cur_val) = c;
378  equiv(cur_val) = o;
379 }
380 
381 /*tex
382 
383 The function |store_primitive_name| sets up the bookkeeping for the reverse
384 lookup. It is quite paranoid, because it is easy to mess this up accidentally.
385 
386 The |offset| is needed because sometimes character codes (in |o|) are indices
387 into |eqtb| or are offset by a magical value to make sure they do not conflict
388 with something else. We don't want the |prim_data[c].names| to have too many
389 entries as it will just be wasted room, so |offset| is substracted from |o|
390 because creating or accessing the array. The |assert(idx<=0xFFFF)| is not
391 strictly needed, but it helps catch errors of this kind.
392 
393 */
394 
396 {
397  int idx;
398  /*
399  if (prim_data[c].offset != 0 && prim_data[c].offset != offset) {
400  assert(false);
401  }
402  */
404  idx = ((int) o - offset);
405  /*
406  assert(idx >= 0);
407  assert(idx <= 0xFFFF);
408  */
409  if (prim_data[c].subids < (idx + 1)) {
410  str_number *new = (str_number *) xcalloc((unsigned) (idx + 1), sizeof(str_number *));
411  if (prim_data[c].names != NULL) {
412  /*
413  assert(prim_data[c].subids);
414  */
415  memcpy(new, (prim_data[c].names), (unsigned) (prim_data[c].subids) * sizeof(str_number));
416  free(prim_data[c].names);
417  }
418  prim_data[c].names = new;
419  prim_data[c].subids = idx + 1;
420  }
421  prim_data[c].names[idx] = s;
422 }
423 
424 /*tex
425 
426 Compared to tex82, |primitive| has two extra parameters. The |off| is an offset
427 that will be passed on to |store_primitive_name|, the |cmd_origin| is the bit
428 that is used to group primitives by originator.
429 
430 */
431 
432 void primitive(const char *thes, quarterword c, halfword o, halfword off, int cmd_origin)
433 {
434  /*tex Needed to fill |prim_eqtb|: */
435  int prim_val;
436  str_number ss;
437  ss = maketexstring(thes);
438  if (cmd_origin == tex_command || cmd_origin == core_command) {
439  primitive_def(thes, strlen(thes), c, o);
440  }
441  prim_val = prim_lookup(ss);
442  prim_origin(prim_val) = (quarterword) cmd_origin;
443  prim_eq_type(prim_val) = c;
444  prim_equiv(prim_val) = o;
445  store_primitive_name(ss, c, o, off);
446 }
447 
448 /*tex
449 
450 Here is a helper that does the actual hash insertion. This code far from ideal:
451 the existance of |hash_extra| changes all the potential (short) coalesced lists
452 into a single (long) one. This will create a slowdown.
453 
454 */
455 
456 static halfword insert_id(halfword p, const unsigned char *j, unsigned int l)
457 {
458  unsigned saved_cur_length;
459  unsigned saved_cur_string_size;
460  unsigned char *saved_cur_string;
461  const unsigned char *k;
462  if (cs_text(p) > 0) {
463  if (hash_high < hash_extra) {
464  incr(hash_high);
465  /*tex
466  Can't we use |eqtb_top| here (perhaps because that is not
467  finalized yet when called from |primitive|?
468  */
470  p = cs_next(p);
471  } else {
472  /*tex
473  Search for an empty location in |hash|.
474  */
475  do {
476  if (hash_is_full)
477  overflow("hash size", (unsigned) (hash_size + hash_extra));
478  decr(hash_used);
479  } while (cs_text(hash_used) != 0);
480  cs_next(p) = hash_used;
481  p = hash_used;
482  }
483  }
484  saved_cur_length = cur_length;
485  saved_cur_string = cur_string;
486  saved_cur_string_size = cur_string_size;
488  for (k = j; k <= j + l - 1; k++) {
489  append_char(*k);
490  }
491  cs_text(p) = make_string();
492  cur_length = saved_cur_length;
493  xfree(cur_string);
494  cur_string = saved_cur_string;
495  cur_string_size = saved_cur_string_size;
496  incr(cs_count);
497  return p;
498 }
499 
500 
501 /*tex
502 
503 Here is the subroutine that searches the hash table for an identifier that
504 matches a given string of length |l>1| appearing in |buffer[j.. (j+l-1)]|. If the
505 identifier is found, the corresponding hash table address is returned. Otherwise,
506 if the global variable |no_new_control_sequence| is |true|, the dummy address
507 |undefined_control_sequence| is returned. Otherwise the identifier is inserted
508 into the hash table and its location is returned.
509 
510 */
511 
512 pointer id_lookup(int j, int l)
513 {
514  /*tex The hash code: */
515  int h;
516  /*tex The index in |hash| array: */
517  pointer p;
518  h = compute_hash((char *) (buffer + j), (unsigned) l, hash_prime);
519  /*tex We start searching here. Note that |0<=h<hash_prime|: */
520  p = h + hash_base;
521  while (1) {
522  if (cs_text(p) > 0)
523  if (str_length(cs_text(p)) == (unsigned) l)
524  if (str_eq_buf(cs_text(p), j))
525  goto FOUND;
526  if (cs_next(p) == 0) {
529  } else {
530  p = insert_id(p, (buffer + j), (unsigned) l);
531  }
532  goto FOUND;
533  }
534  p = cs_next(p);
535  }
536  FOUND:
537  return p;
538 }
539 
540 /*tex
541 
542 Here is a similar subroutine for finding a primitive in the hash.
543 This one is based on a C string.
544 
545 */
546 
547 pointer string_lookup(const char *s, size_t l)
548 {
549  /*tex The hash code: */
550  int h;
551  /*tex The index in |hash| array: */
552  pointer p;
553  h = compute_hash(s, (unsigned) l, hash_prime);
554  /*tex We start searching here. Note that |0<=h<hash_prime|: */
555  p = h + hash_base;
556  while (1) {
557  if (cs_text(p) > 0)
558  if (str_eq_cstr(cs_text(p), s, l))
559  goto FOUND;
560  if (cs_next(p) == 0) {
563  } else {
564  p = insert_id(p, (const unsigned char *) s, (unsigned) l);
565  }
566  goto FOUND;
567  }
568  p = cs_next(p);
569  }
570  FOUND:
571  return p;
572 }
573 
574 /*tex
575 
576 The |print_cmd_chr| routine prints a symbolic interpretation of a command code
577 and its modifier. This is used in certain `\.{You can\'t}' error messages, and in
578 the implementation of diagnostic routines like \.{\\show}.
579 
580 The body of |print_cmd_chr| use to be a rather tedious listing of print commands,
581 and most of it was essentially an inverse to the |primitive| routine that enters
582 a \TeX\ primitive into |eqtb|.
583 
584 Thanks to |prim_data|, there is no need for all that tediousness. What is left of
585 |primt_cnd_chr| are just the exceptions to the general rule that the
586 |cmd,chr_code| pair represents in a single primitive command.
587 
588 */
589 
590 #define chr_cmd(A) do { tprint(A); print(chr_code); } while (0)
591 
592 static void prim_cmd_chr(quarterword cmd, halfword chr_code)
593 {
594  int idx = chr_code - prim_data[cmd].offset;
595  if (cmd <= last_cmd &&
596  idx >= 0 && idx < prim_data[cmd].subids &&
597  prim_data[cmd].names != NULL && prim_data[cmd].names[idx] != 0) {
598  tprint_esc("");
600  } else {
601  /* \TEX82 didn't print the |cmd,idx| information, but it may be useful. */
602  tprint("[unknown command code! (");
603  print_int(cmd);
604  tprint(", ");
605  print_int(idx);
606  tprint(")]");
607  }
608 }
609 
611 {
612  int n;
613  switch (cmd) {
614  case left_brace_cmd:
615  chr_cmd("begin-group character ");
616  break;
617  case right_brace_cmd:
618  chr_cmd("end-group character ");
619  break;
620  case math_shift_cmd:
621  chr_cmd("math shift character ");
622  break;
623  case mac_param_cmd:
624  if (chr_code == tab_mark_cmd_code)
625  tprint_esc("alignmark");
626  else
627  chr_cmd("macro parameter character ");
628  break;
629  case sup_mark_cmd:
630  chr_cmd("superscript character ");
631  break;
632  case sub_mark_cmd:
633  chr_cmd("subscript character ");
634  break;
635  case endv_cmd:
636  tprint("end of alignment template");
637  break;
638  case spacer_cmd:
639  chr_cmd("blank space ");
640  break;
641  case letter_cmd:
642  chr_cmd("the letter ");
643  break;
644  case other_char_cmd:
645  chr_cmd("the character ");
646  break;
647  case tab_mark_cmd:
648  if (chr_code == span_code)
649  tprint_esc("span");
650  else if (chr_code == tab_mark_cmd_code)
651  tprint_esc("aligntab");
652  else
653  chr_cmd("alignment tab character ");
654  break;
655  case if_test_cmd:
656  if (chr_code >= unless_code)
657  tprint_esc("unless");
658  prim_cmd_chr(cmd, (chr_code % unless_code));
659  break;
660  case char_given_cmd:
661  tprint_esc("char");
662  print_qhex(chr_code);
663  break;
664  case math_given_cmd:
665  /*tex
666  Okay, it's better for old macro packages that mess with meaning
667  to report a traditional value. A compromise.
668  */
669  tprint_esc("mathchar");
670  show_mathcode_value_old(chr_code);
671  break;
672  case xmath_given_cmd:
673  tprint_esc("Umathchar");
675  break;
677  tprint("expandable luacall ");
678  print_int(chr_code);
679  break;
680  case lua_local_call_cmd:
681  tprint("local luacall ");
682  print_int(chr_code);
683  break;
684  case lua_call_cmd:
685  tprint("luacall ");
686  print_int(chr_code);
687  break;
688  case set_font_cmd:
689  tprint("select font ");
690  tprint(font_name(chr_code));
691  if (font_size(chr_code) != font_dsize(chr_code)) {
692  tprint(" at ");
693  print_scaled(font_size(chr_code));
694  tprint("pt");
695  }
696  break;
697  case undefined_cs_cmd:
698  tprint("undefined");
699  break;
700  case call_cmd:
701  case long_call_cmd:
702  case outer_call_cmd:
703  case long_outer_call_cmd:
704  n = cmd - call_cmd;
705  if (token_info(token_link(chr_code)) == protected_token)
706  n = n + 4;
707  if (odd(n / 4))
708  tprint_esc("protected");
709  if (odd(n))
710  tprint_esc("long");
711  if (odd(n / 2))
712  tprint_esc("outer");
713  if (n > 0)
714  tprint(" ");
715  tprint("macro");
716  break;
717  case assign_glue_cmd:
718  case assign_mu_glue_cmd:
719  if (chr_code < skip_base) {
720  prim_cmd_chr(cmd, chr_code);
721  } else if (chr_code < mu_skip_base) {
722  tprint_esc("skip");
723  print_int(chr_code - skip_base);
724  } else {
725  tprint_esc("muskip");
726  print_int(chr_code - mu_skip_base);
727  }
728  break;
729  case assign_toks_cmd:
730  if (chr_code >= toks_base) {
731  tprint_esc("toks");
732  print_int(chr_code - toks_base);
733  } else {
734  prim_cmd_chr(cmd, chr_code);
735  }
736  break;
737  case assign_int_cmd:
738  if (chr_code < count_base) {
739  prim_cmd_chr(cmd, chr_code);
740  } else {
741  tprint_esc("count");
742  print_int(chr_code - count_base);
743  }
744  break;
745  case assign_attr_cmd:
746  tprint_esc("attribute");
747  print_int(chr_code - attribute_base);
748  break;
749  case assign_dimen_cmd:
750  if (chr_code < scaled_base) {
751  prim_cmd_chr(cmd, chr_code);
752  } else {
753  tprint_esc("dimen");
754  print_int(chr_code - scaled_base);
755  }
756  break;
757  case normal_cmd:
758  if (chr_code < prim_data[cmd].subids && prim_data[cmd].names[chr_code] != 0) {
759  prim_cmd_chr(cmd, chr_code);
760  } else {
761  tprint("[unknown command! (");
762  print_int(chr_code);
763  tprint(")]");
764  }
765  break;
766  case extension_cmd:
767  if (chr_code < prim_data[cmd].subids && prim_data[cmd].names[chr_code] != 0) {
768  prim_cmd_chr(cmd, chr_code);
769  } else {
770  tprint("[unknown extension! (");
771  print_int(chr_code);
772  tprint(")]");
773 
774  }
775  break;
776  case node_cmd:
777  tprint("node ");
778  print_int(chr_code);
779  break;
780  default:
781  /*tex These are most commands, actually. */
782  prim_cmd_chr(cmd, chr_code);
783  break;
784  }
785 }
q
Definition: afm2pl.c:2287
#define tab_mark_cmd_code
Definition: align.h:38
void print_scaled(scaled s)
Definition: aptex-src.c:8377
void print_int(integer n)
Definition: aptex-src.c:7042
#define mu_skip_base
Definition: aptex-macros.h:587
#define prim_prime
Definition: aptex-macros.h:929
#define eq_level(a)
Definition: aptex-macros.h:535
#define skip_base
Definition: aptex-macros.h:586
#define span_code
#define cur_length
Definition: aptex-macros.h:69
#define eq_type(a)
Definition: aptex-macros.h:536
#define level_one
Definition: aptex-macros.h:539
#define prim_size
Definition: aptex-macros.h:558
#define scaled_base
Definition: aptex-macros.h:889
#define undump_int
#define hash_base
Definition: aptex-macros.h:544
#define count_base
Definition: aptex-macros.h:776
#define protected_token
Definition: aptex-macros.h:988
#define unless_code
#define eqtb_size
Definition: aptex-macros.h:891
#define undefined_primitive
Definition: aptex-macros.h:940
#define undefined_control_sequence
Definition: aptex-macros.h:561
#define toks_base
Definition: aptex-macros.h:630
#define undump_hh
integer str_number
Definition: aptex.h:196
@ hash_prime
Definition: aptex.h:175
@ hash_size
Definition: aptex.h:176
#define n
Definition: t4ht.c:1290
#define free(a)
Definition: decNumber.cpp:310
#define dump_wd
Definition: dumpdata.h:78
#define dump_int(x)
Definition: dumpdata.h:87
#define dump_hh
Definition: dumpdata.h:79
#define undump_wd
Definition: dumpdata.h:81
int h
Definition: dviconv.c:9
unsigned short halfword
Definition: dvips.h:68
#define xfree(p)
Definition: ptexmac.h:85
#define attribute_base
Definition: equivalents.h:340
unsigned char * pointer
Definition: fontmisc.h:33
Boolean_T str_eq_str(StrNumber_T s1, StrNumber_T s2)
Boolean_T str_eq_buf(StrNumber_T s, BufType_T buf, BufPointer_T bf_ptr, BufPointer_T len)
#define s
Definition: afcover.h:80
#define c(n)
Definition: gpos-common.c:150
#define memcpy(d, s, n)
Definition: gsftopk.c:64
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
FT_UInt idx
Definition: cffcmap.c:135
#define xmalloc(size)
Definition: writet1.c:33
KPSEDLL address xcalloc(size_t nelem, size_t elsize)
Definition: xcalloc.c:23
#define decr(x)
Definition: cpascal.h:91
#define incr(x)
Definition: cpascal.h:92
#define equiv
Definition: ctangleboot.c:107
static int cur_val
Definition: ctangleboot.c:325
void overflow(const char *)
Definition: cwebboot.c:1385
strnumber maketexstring(const char *)
Definition: stringpool.c:249
boolean str_eq_cstr(strnumber, char *)
void show_mathcode_value(mathcodeval c)
Definition: mathcodes.c:104
mathcodeval mathchar_from_integer(int value, int extcode)
Definition: mathcodes.c:82
void show_mathcode_value_old(int value)
Definition: mathcodes.c:98
#define umath_mathcode
Definition: mathcodes.h:29
#define cmd(arg)
Definition: mitsu.h:44
list names
Definition: fc-lang.py:151
dictionary off
Definition: fc-lang.py:226
int k
Definition: otp-parser.c:70
#define odd(n)
Definition: pbmplus.h:227
#define print(s)
Definition: pbmtoln03.c:48
char quarterword
Definition: pbmtopk.c:39
struct const_name font_name[]
Definition: picttoppm.c:492
static int offset
Definition: ppmtogif.c:642
void print_cmd_chr(quarterword cmd, halfword chr_code)
Definition: primitive.c:610
#define prim_text(a)
Definition: primitive.c:108
pointer string_lookup(const char *s, size_t l)
Definition: primitive.c:547
#define chr_cmd(A)
Definition: primitive.c:590
halfword hash_high
Definition: primitive.c:71
#define prim_eq_type(a)
Definition: primitive.c:126
boolean is_primitive(str_number csname)
Definition: primitive.c:270
static halfword insert_id(halfword p, const unsigned char *j, unsigned int l)
Definition: primitive.c:456
boolean no_new_control_sequence
Definition: primitive.c:75
#define prim_next(a)
Definition: primitive.c:104
void primitive(const char *thes, quarterword c, halfword o, halfword off, int cmd_origin)
Definition: primitive.c:432
int hash_extra
Definition: primitive.c:63
#define prim_equiv(a)
Definition: primitive.c:130
#define prim_base
Definition: primitive.c:92
void init_primitives(void)
Definition: primitive.c:166
void dump_primitives(void)
Definition: primitive.c:316
quarterword get_prim_eq_type(int p)
Definition: primitive.c:289
int cs_count
Definition: primitive.c:79
two_halves * hash
Definition: primitive.c:55
static halfword compute_hash(const char *j, unsigned int l, halfword prime_number)
Definition: primitive.c:194
void undump_primitives(void)
Definition: primitive.c:334
halfword hash_used
Definition: primitive.c:59
static void prim_cmd_chr(quarterword cmd, halfword chr_code)
Definition: primitive.c:592
quarterword get_prim_origin(int p)
Definition: primitive.c:294
static prim_info prim_data[(last_cmd+1)]
Definition: primitive.c:158
static two_halves prim[(prim_size+1)]
Definition: primitive.c:138
halfword hash_top
Definition: primitive.c:67
void primitive_def(const char *s, size_t l, quarterword c, halfword o)
Definition: primitive.c:369
static void store_primitive_name(str_number s, quarterword c, halfword o, halfword offset)
Definition: primitive.c:395
pointer id_lookup(int j, int l)
Definition: primitive.c:512
#define hash_is_full
Definition: primitive.c:83
struct prim_info prim_info
str_number get_prim_text(int p)
Definition: primitive.c:304
static memory_word prim_eqtb[(prim_size+1)]
Definition: primitive.c:140
#define prim_origin(a)
Definition: primitive.c:122
static pointer prim_used
Definition: primitive.c:134
#define prim_is_full
Definition: primitive.c:112
void ini_init_primitives(void)
Definition: primitive.c:179
halfword get_prim_equiv(int p)
Definition: primitive.c:299
pointer prim_lookup(str_number s)
Definition: primitive.c:213
#define cs_text(a)
Definition: primitive.h:49
#define cs_next(a)
Definition: primitive.h:48
@ tex_command
Definition: primitive.h:28
@ core_command
Definition: primitive.h:32
void print_qhex(int n)
Definition: printing.c:711
void tprint(const char *sss)
Definition: printing.c:415
void tprint_esc(const char *s)
Definition: printing.c:624
bstring c int memset(void *s, int c, int length)
@ math_given_cmd
Definition: commands.h:156
@ spacer_cmd
Definition: commands.h:77
@ normal_cmd
Definition: commands.h:135
@ call_cmd
Definition: commands.h:222
@ math_shift_cmd
Definition: commands.h:68
@ lua_call_cmd
Definition: commands.h:140
@ assign_glue_cmd
Definition: commands.h:165
@ sup_mark_cmd
Definition: commands.h:73
@ assign_attr_cmd
Definition: commands.h:163
@ undefined_cs_cmd
Definition: commands.h:208
@ set_font_cmd
Definition: commands.h:183
@ lua_local_call_cmd
Definition: commands.h:213
@ letter_cmd
Definition: commands.h:78
@ assign_int_cmd
Definition: commands.h:162
@ extension_cmd
Definition: commands.h:136
@ assign_mu_glue_cmd
Definition: commands.h:166
@ endv_cmd
Definition: commands.h:75
@ other_char_cmd
Definition: commands.h:79
@ xmath_given_cmd
Definition: commands.h:157
@ assign_dimen_cmd
Definition: commands.h:164
@ char_given_cmd
Definition: commands.h:154
@ tab_mark_cmd
Definition: commands.h:69
@ left_brace_cmd
Definition: commands.h:66
@ long_outer_call_cmd
Definition: commands.h:225
@ mac_param_cmd
Definition: commands.h:72
@ sub_mark_cmd
Definition: commands.h:74
@ assign_toks_cmd
Definition: commands.h:161
@ node_cmd
Definition: commands.h:92
@ outer_call_cmd
Definition: commands.h:224
@ right_brace_cmd
Definition: commands.h:67
@ if_test_cmd
Definition: commands.h:214
@ long_call_cmd
Definition: commands.h:223
@ lua_expandable_call_cmd
Definition: commands.h:212
#define last_cmd
Definition: commands.h:235
static void make_string(char **ppstr, int n)
Definition: scanid.c:232
void reset_cur_string(void)
Definition: stringpool.c:87
unsigned cur_string_size
Definition: stringpool.c:76
char * makecstring(int s)
Definition: stringpool.c:284
unsigned char * cur_string
Definition: stringpool.c:74
#define STRING_OFFSET
Definition: stringpool.h:41
#define str_string(a)
Definition: stringpool.h:60
#define str_length(a)
Definition: stringpool.h:59
#define append_char(A)
Definition: stringpool.h:84
Definition: utils.c:300
halfword subids
Definition: primitive.c:151
halfword offset
Definition: primitive.c:153
str_number * names
Definition: primitive.c:155
int j
Definition: t4ht.c:1589
*job_name strlen((char *) job_name) - 4)
m
Definition: tex4ht.c:3990
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)
#define font_size(a)
Definition: texfont.h:235
#define font_dsize(a)
Definition: texfont.h:237
#define token_link(a)
Definition: textoken.h:72
#define token_info(a)
Definition: textoken.h:71
#define FOUND
Definition: vlna.c:17