From ed85eb918354b77672bbe347c2afcfe2e0b6b7fb Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 22 Jul 2021 19:30:29 +0200 Subject: 2021-07-22 19:14:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-phb-imp-library.lua | 498 +++++++++++++++++++++ tex/context/base/mkiv/mlib-pps.lua | 2 + tex/context/base/mkiv/page-imp.mkiv | 9 + tex/context/base/mkiv/publ-imp-aps-prb.mkvi | 40 ++ tex/context/base/mkiv/status-files.pdf | Bin 23616 -> 23589 bytes tex/context/base/mkiv/status-lua.pdf | Bin 248528 -> 248533 bytes tex/context/base/mkxl/cont-new.mkxl | 2 +- tex/context/base/mkxl/context.mkxl | 2 +- tex/context/base/mkxl/core-uti.lmt | 437 ++++++++++++++++++ tex/context/base/mkxl/core-uti.lua | 470 ------------------- tex/context/base/mkxl/meta-imp-kindergarten.mkxl | 118 +++++ tex/context/base/mkxl/meta-imp-placeholders.mkxl | 83 ++++ tex/context/base/mkxl/meta-imp-txt.lmt | 116 +++++ tex/context/base/mkxl/mlib-pps.lmt | 2 + tex/context/base/mkxl/page-imp.mkxl | 9 + tex/context/base/mkxl/typo-bld.lmt | 2 +- .../modules/common/s-abbreviations-extras.tex | 56 --- .../modules/common/s-abbreviations-logos.tex | 376 ---------------- .../modules/common/s-abbreviations-mixed.mkiv | 28 -- .../modules/common/s-abbreviations-pseudocaps.mkiv | 30 -- .../modules/common/s-abbreviations-smallcaps.mkiv | 31 -- .../modules/common/s-abbreviations-words.mkiv | 28 -- tex/context/modules/common/s-obsolete-tokens.mkiv | 346 -------------- .../modules/mkiv/s-abbreviations-extras.tex | 56 +++ tex/context/modules/mkiv/s-abbreviations-logos.tex | 376 ++++++++++++++++ tex/context/modules/mkiv/s-obsolete-tokens.mkiv | 346 ++++++++++++++ tex/context/modules/mkiv/s-physics-units.lua | 86 ++++ tex/context/modules/mkiv/s-version.mkiv | 123 +++++ tex/context/modules/mkxl/s-system-tokens.lmt | 247 ++++++++++ tex/context/modules/mkxl/s-system-tokens.mkxl | 47 +- tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 35 files changed, 2558 insertions(+), 1418 deletions(-) create mode 100644 tex/context/base/mkiv/font-phb-imp-library.lua create mode 100644 tex/context/base/mkiv/publ-imp-aps-prb.mkvi create mode 100644 tex/context/base/mkxl/core-uti.lmt delete mode 100644 tex/context/base/mkxl/core-uti.lua create mode 100644 tex/context/base/mkxl/meta-imp-kindergarten.mkxl create mode 100644 tex/context/base/mkxl/meta-imp-placeholders.mkxl create mode 100644 tex/context/base/mkxl/meta-imp-txt.lmt delete mode 100644 tex/context/modules/common/s-abbreviations-extras.tex delete mode 100644 tex/context/modules/common/s-abbreviations-logos.tex delete mode 100644 tex/context/modules/common/s-abbreviations-mixed.mkiv delete mode 100644 tex/context/modules/common/s-abbreviations-pseudocaps.mkiv delete mode 100644 tex/context/modules/common/s-abbreviations-smallcaps.mkiv delete mode 100644 tex/context/modules/common/s-abbreviations-words.mkiv delete mode 100644 tex/context/modules/common/s-obsolete-tokens.mkiv create mode 100644 tex/context/modules/mkiv/s-abbreviations-extras.tex create mode 100644 tex/context/modules/mkiv/s-abbreviations-logos.tex create mode 100644 tex/context/modules/mkiv/s-obsolete-tokens.mkiv create mode 100644 tex/context/modules/mkiv/s-physics-units.lua create mode 100644 tex/context/modules/mkiv/s-version.mkiv create mode 100644 tex/context/modules/mkxl/s-system-tokens.lmt diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index ddc6e4c94..c85382380 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2021.07.21 19:51} +\newcontextversion{2021.07.22 19:11} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index f51879ef6..4c02f23df 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2021.07.21 19:51} +\edef\contextversion{2021.07.22 19:11} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index 668a2bb71..bc2a91dcf 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.21 19:51} +\newcontextversion{2021.07.22 19:11} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index c49efc796..061a6651d 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2021.07.21 19:51} +\edef\contextversion{2021.07.22 19:11} %D Kind of special: diff --git a/tex/context/base/mkiv/font-phb-imp-library.lua b/tex/context/base/mkiv/font-phb-imp-library.lua new file mode 100644 index 000000000..fe991b023 --- /dev/null +++ b/tex/context/base/mkiv/font-phb-imp-library.lua @@ -0,0 +1,498 @@ +if not modules then modules = { } end modules ['font-phb-imp-library'] = { + version = 1.000, -- 2020.01.08, + comment = "companion to font-txt.mkiv", + original = "derived from a prototype by Kai Eigner", + author = "Hans Hagen", -- so don't blame KE + copyright = "TAT Zetwerk / PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +-- The hb library comes in versions and the one I tested in 2016 was part of the inkscape +-- suite. In principle one can have incompatibilities due to updates but that is the nature +-- of a library. When a library ie expected one has better use the system version, if only +-- to make sure that different programs behave the same. +-- +-- The main reason for testing this approach was that when Idris was working on his fonts, +-- we wanted to know how different shapers deal with it and the hb command line program +-- could provide uniscribe output. For the context shaper uniscribe is the reference, also +-- because Idris started out with Volt a decade ago. +-- +-- We treat the lib as a black box as it should be. At some point Kai Eigner made an ffi +-- binding and that one was adapted to the plugin approach of context. It saved me the +-- trouble of looking at source files to figure it all out. Below is the adapted code. +-- +-- Keep in mind that this file is for mkiv only. It won't work in lmtx where instead of +-- ffi we use simple optional libraries with delayed bindings. In principle this mechanism +-- is generic but because other macropackages follow another route we don't spend time +-- on that code path here. + +local next, tonumber, pcall = next, tonumber, pcall +local reverse = table.reverse +local loaddata = io.loaddata + +local report = utilities.hb.report or print +local packtoutf32 = utilities.hb.helpers.packtoutf32 + +if not FFISUPPORTED or not ffi then + report("no ffi support") + return +elseif CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then + report("no ffi support") + return +elseif not context then + return +end + +local harfbuzz = ffilib(os.name == "windows" and "libharfbuzz-0" or "libharfbuzz") + +if not harfbuzz then + report("no hb library found") + return +end + +-- jit.on() : on very long (hundreds of pages) it looks faster but +-- the normal font processor slows down ... this is consistent with +-- earlier observations that turning it on is often slower on these +-- one-shot tex runs (also because we don't use many math and/or +-- string helpers and therefore the faster vm of luajit gives most +-- benefits (given the patched hasher) + +-- Here is Kai's ffi mapping, a bit reorganized. We only define what we +-- need. I'm happy that Kai did the deciphering of the api that I could +-- then build upon. + +ffi.cdef [[ + +typedef struct hb_blob_t hb_blob_t ; + +typedef enum { + HB_MEMORY_MODE_DUPLICATE, + HB_MEMORY_MODE_READONLY, + HB_MEMORY_MODE_WRITABLE, + HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE +} hb_memory_mode_t ; + +typedef void (*hb_destroy_func_t) ( + void *user_data +) ; + +typedef struct hb_face_t hb_face_t ; + +typedef const struct hb_language_impl_t *hb_language_t ; + +typedef struct hb_buffer_t hb_buffer_t ; + +typedef enum { + HB_SCRIPT_COMMON, HB_SCRIPT_INHERITED, HB_SCRIPT_UNKNOWN, + + HB_SCRIPT_ARABIC, HB_SCRIPT_ARMENIAN, HB_SCRIPT_BENGALI, HB_SCRIPT_CYRILLIC, + HB_SCRIPT_DEVANAGARI, HB_SCRIPT_GEORGIAN, HB_SCRIPT_GREEK, + HB_SCRIPT_GUJARATI, HB_SCRIPT_GURMUKHI, HB_SCRIPT_HANGUL, HB_SCRIPT_HAN, + HB_SCRIPT_HEBREW, HB_SCRIPT_HIRAGANA, HB_SCRIPT_KANNADA, HB_SCRIPT_KATAKANA, + HB_SCRIPT_LAO, HB_SCRIPT_LATIN, HB_SCRIPT_MALAYALAM, HB_SCRIPT_ORIYA, + HB_SCRIPT_TAMIL, HB_SCRIPT_TELUGU, HB_SCRIPT_THAI, HB_SCRIPT_TIBETAN, + HB_SCRIPT_BOPOMOFO, HB_SCRIPT_BRAILLE, HB_SCRIPT_CANADIAN_SYLLABICS, + HB_SCRIPT_CHEROKEE, HB_SCRIPT_ETHIOPIC, HB_SCRIPT_KHMER, HB_SCRIPT_MONGOLIAN, + HB_SCRIPT_MYANMAR, HB_SCRIPT_OGHAM, HB_SCRIPT_RUNIC, HB_SCRIPT_SINHALA, + HB_SCRIPT_SYRIAC, HB_SCRIPT_THAANA, HB_SCRIPT_YI, HB_SCRIPT_DESERET, + HB_SCRIPT_GOTHIC, HB_SCRIPT_OLD_ITALIC, HB_SCRIPT_BUHID, HB_SCRIPT_HANUNOO, + HB_SCRIPT_TAGALOG, HB_SCRIPT_TAGBANWA, HB_SCRIPT_CYPRIOT, HB_SCRIPT_LIMBU, + HB_SCRIPT_LINEAR_B, HB_SCRIPT_OSMANYA, HB_SCRIPT_SHAVIAN, HB_SCRIPT_TAI_LE, + HB_SCRIPT_UGARITIC, HB_SCRIPT_BUGINESE, HB_SCRIPT_COPTIC, + HB_SCRIPT_GLAGOLITIC, HB_SCRIPT_KHAROSHTHI, HB_SCRIPT_NEW_TAI_LUE, + HB_SCRIPT_OLD_PERSIAN, HB_SCRIPT_SYLOTI_NAGRI, HB_SCRIPT_TIFINAGH, + HB_SCRIPT_BALINESE, HB_SCRIPT_CUNEIFORM, HB_SCRIPT_NKO, HB_SCRIPT_PHAGS_PA, + HB_SCRIPT_PHOENICIAN, HB_SCRIPT_CARIAN, HB_SCRIPT_CHAM, HB_SCRIPT_KAYAH_LI, + HB_SCRIPT_LEPCHA, HB_SCRIPT_LYCIAN, HB_SCRIPT_LYDIAN, HB_SCRIPT_OL_CHIKI, + HB_SCRIPT_REJANG, HB_SCRIPT_SAURASHTRA, HB_SCRIPT_SUNDANESE, HB_SCRIPT_VAI, + HB_SCRIPT_AVESTAN, HB_SCRIPT_BAMUM, HB_SCRIPT_EGYPTIAN_HIEROGLYPHS, + HB_SCRIPT_IMPERIAL_ARAMAIC, HB_SCRIPT_INSCRIPTIONAL_PAHLAVI, + HB_SCRIPT_INSCRIPTIONAL_PARTHIAN, HB_SCRIPT_JAVANESE, HB_SCRIPT_KAITHI, + HB_SCRIPT_LISU, HB_SCRIPT_MEETEI_MAYEK, HB_SCRIPT_OLD_SOUTH_ARABIAN, + HB_SCRIPT_OLD_TURKIC, HB_SCRIPT_SAMARITAN, HB_SCRIPT_TAI_THAM, + HB_SCRIPT_TAI_VIET, HB_SCRIPT_BATAK, HB_SCRIPT_BRAHMI, HB_SCRIPT_MANDAIC, + HB_SCRIPT_CHAKMA, HB_SCRIPT_MEROITIC_CURSIVE, HB_SCRIPT_MEROITIC_HIEROGLYPHS, + HB_SCRIPT_MIAO, HB_SCRIPT_SHARADA, HB_SCRIPT_SORA_SOMPENG, HB_SCRIPT_TAKRI, + HB_SCRIPT_BASSA_VAH, HB_SCRIPT_CAUCASIAN_ALBANIAN, HB_SCRIPT_DUPLOYAN, + HB_SCRIPT_ELBASAN, HB_SCRIPT_GRANTHA, HB_SCRIPT_KHOJKI, HB_SCRIPT_KHUDAWADI, + HB_SCRIPT_LINEAR_A, HB_SCRIPT_MAHAJANI, HB_SCRIPT_MANICHAEAN, + HB_SCRIPT_MENDE_KIKAKUI, HB_SCRIPT_MODI, HB_SCRIPT_MRO, HB_SCRIPT_NABATAEAN, + HB_SCRIPT_OLD_NORTH_ARABIAN, HB_SCRIPT_OLD_PERMIC, HB_SCRIPT_PAHAWH_HMONG, + HB_SCRIPT_PALMYRENE, HB_SCRIPT_PAU_CIN_HAU, HB_SCRIPT_PSALTER_PAHLAVI, + HB_SCRIPT_SIDDHAM, HB_SCRIPT_TIRHUTA, HB_SCRIPT_WARANG_CITI, HB_SCRIPT_AHOM, + HB_SCRIPT_ANATOLIAN_HIEROGLYPHS, HB_SCRIPT_HATRAN, HB_SCRIPT_MULTANI, + HB_SCRIPT_OLD_HUNGARIAN, HB_SCRIPT_SIGNWRITING, HB_SCRIPT_ADLAM, + HB_SCRIPT_BHAIKSUKI, HB_SCRIPT_MARCHEN, HB_SCRIPT_OSAGE, HB_SCRIPT_TANGUT, + HB_SCRIPT_NEWA, HB_SCRIPT_MASARAM_GONDI, HB_SCRIPT_NUSHU, HB_SCRIPT_SOYOMBO, + HB_SCRIPT_ZANABAZAR_SQUARE, HB_SCRIPT_DOGRA, HB_SCRIPT_GUNJALA_GONDI, + HB_SCRIPT_HANIFI_ROHINGYA, HB_SCRIPT_MAKASAR, HB_SCRIPT_MEDEFAIDRIN, + HB_SCRIPT_OLD_SOGDIAN, HB_SCRIPT_SOGDIAN, HB_SCRIPT_ELYMAIC, + HB_SCRIPT_NANDINAGARI, HB_SCRIPT_NYIAKENG_PUACHUE_HMONG, HB_SCRIPT_WANCHO, + + HB_SCRIPT_INVALID, _HB_SCRIPT_MAX_VALUE, _HB_SCRIPT_MAX_VALUE_SIGNED, +} hb_script_t ; + +typedef enum { + HB_DIRECTION_INVALID, + HB_DIRECTION_LTR, + HB_DIRECTION_RTL, + HB_DIRECTION_TTB, + HB_DIRECTION_BTT +} hb_direction_t ; + +typedef int hb_bool_t ; + +typedef uint32_t hb_tag_t ; + +typedef struct hb_feature_t { + hb_tag_t tag; + uint32_t value; + unsigned int start; + unsigned int end; +} hb_feature_t ; + +typedef struct hb_font_t hb_font_t ; + +typedef uint32_t hb_codepoint_t ; +typedef int32_t hb_position_t ; +typedef uint32_t hb_mask_t ; + +typedef union _hb_var_int_t { + uint32_t u32; + int32_t i32; + uint16_t u16[2]; + int16_t i16[2]; + uint8_t u8[4]; + int8_t i8[4]; +} hb_var_int_t ; + +typedef struct hb_glyph_info_t { + hb_codepoint_t codepoint ; + hb_mask_t mask ; + uint32_t cluster ; + /*< private >*/ + hb_var_int_t var1 ; + hb_var_int_t var2 ; +} hb_glyph_info_t ; + +typedef struct hb_glyph_position_t { + hb_position_t x_advance ; + hb_position_t y_advance ; + hb_position_t x_offset ; + hb_position_t y_offset ; + /*< private >*/ + hb_var_int_t var ; +} hb_glyph_position_t ; + +const char * hb_version_string ( + void +) ; + +hb_blob_t * hb_blob_create ( + const char *data, + unsigned int length, + hb_memory_mode_t mode, + void *user_data, + hb_destroy_func_t destroy +) ; + +void hb_blob_destroy ( + hb_blob_t *blob +) ; + +hb_face_t * hb_face_create ( + hb_blob_t *blob, + unsigned int index +) ; + +void hb_face_destroy ( + hb_face_t *face +) ; + +hb_language_t hb_language_from_string ( + const char *str, + int len +) ; + +void hb_buffer_set_language ( + hb_buffer_t *buffer, + hb_language_t language +) ; + +hb_script_t hb_script_from_string ( + const char *s, + int len +) ; + +void hb_buffer_set_script ( + hb_buffer_t *buffer, + hb_script_t script +) ; + +hb_direction_t hb_direction_from_string ( + const char *str, + int len +) ; + +void hb_buffer_set_direction ( + hb_buffer_t *buffer, + hb_direction_t direction +) ; + +hb_bool_t hb_feature_from_string ( + const char *str, + int len, + hb_feature_t *feature +) ; + +hb_bool_t hb_shape_full ( + hb_font_t *font, + hb_buffer_t *buffer, + const hb_feature_t *features, + unsigned int num_features, + const char * const *shaper_list +) ; + + +hb_buffer_t * hb_buffer_create ( + void +) ; + +void hb_buffer_destroy ( + hb_buffer_t *buffer +) ; + +void hb_buffer_add_utf8 ( + hb_buffer_t *buffer, + const char *text, + int text_length, + unsigned int item_offset, + int item_length +) ; + +void hb_buffer_add_utf32 ( + hb_buffer_t *buffer, + const char *text, + int text_length, + unsigned int item_offset, + int item_length +) ; + +void hb_buffer_add ( + hb_buffer_t *buffer, + hb_codepoint_t codepoint, + unsigned int cluster +) ; + +unsigned int hb_buffer_get_length ( + hb_buffer_t *buffer +) ; + +hb_glyph_info_t * hb_buffer_get_glyph_infos ( + hb_buffer_t *buffer, + unsigned int *length +) ; + +hb_glyph_position_t *hb_buffer_get_glyph_positions ( + hb_buffer_t *buffer, + unsigned int *length +) ; + +void hb_buffer_reverse ( + hb_buffer_t *buffer +) ; + +void hb_buffer_reset ( + hb_buffer_t *buffer +) ; + +void hb_buffer_guess_segment_properties ( + hb_buffer_t *buffer +) ; + +hb_font_t * hb_font_create ( + hb_face_t *face +) ; + +void hb_font_destroy ( + hb_font_t *font +) ; + +void hb_font_set_scale ( + hb_font_t *font, + int x_scale, + int y_scale +) ; + +void hb_ot_font_set_funcs ( + hb_font_t *font +) ; + +unsigned int hb_face_get_upem ( + hb_face_t *face +) ; + +const char ** hb_shape_list_shapers ( + void +); +]] + +-- The library must be somewhere accessible. The calls to the library are similar to +-- the ones in the prototype but we organize things a bit differently. I tried to alias +-- the functions in the harfbuzz namespace (luajittex will optimize this anyway but +-- normal luatex not) but it crashes luajittex so I revered that. + +do + + local l = harfbuzz.hb_shape_list_shapers() + local s = { } + + for i=0,9 do + local str = l[i] + if str == ffi.NULL then + break + else + s[#s+1] = ffi.string(str) + end + end + + report("using hb library version %a, supported shapers: %,t",ffi.string(harfbuzz.hb_version_string()),s) + +end + +-- we don't want to store userdata in the public data blob + +local fontdata = fonts.hashes.identifiers + +local loaded = { } +local shared = { } +local featured = { } + +local function loadfont(font) + local tfmdata = fontdata[font] + local resources = tfmdata.resources + local filename = resources.filename + local instance = shared[filename] + if not instance then + local wholefont = io.loaddata(filename) + local wholeblob = ffi.gc(harfbuzz.hb_blob_create(wholefont,#wholefont,0,nil,nil),harfbuzz.hb_blob_destroy) + local wholeface = ffi.gc(harfbuzz.hb_face_create(wholeblob,font),harfbuzz.hb_face_destroy) + local scale = harfbuzz.hb_face_get_upem(wholeface) + instance = ffi.gc(harfbuzz.hb_font_create(wholeface),harfbuzz.hb_font_destroy) + harfbuzz.hb_font_set_scale(instance,scale,scale) + harfbuzz.hb_ot_font_set_funcs(instance) + shared[filename] = instance + end + return instance +end + +local function loadfeatures(data) + local featureset = data.featureset or { } + local feature = ffi.new("hb_feature_t[?]",#featureset) + local featurespec = feature[0] + local noffeatures = 0 + for i=1,#featureset do + local f = featureset[i] + harfbuzz.hb_feature_from_string(f,#f,feature[noffeatures]) + noffeatures = noffeatures + 1 + end + return { + noffeatures = #featureset, + featureblob = feature, + featurespec = featurespec, + } +end + +local function crap(t) + return ffi.new("const char *[?]", #t, t) +end + +local shapers = { + native = crap { "ot", "uniscribe", "fallback" }, + uniscribe = crap { "uniscribe", "ot", "fallback" }, + -- uniscribe = crap { "uniscribe", "fallback" }, -- stalls without fallback when no uniscribe present + fallback = crap { "fallback" }, +} + +-- Reusing a buffer doesn't make a difference in performance so we forget +-- about it and keep things simple. Todo: check if using locals makes sense. + +function utilities.hb.methods.library(font,data,rlmode,text,leading,trailing) + local instance = loaded[font] + if not instance then + instance = loadfont(font) + loaded[font] = instance + end + -- todo: dflt -> DFLT ? + -- todo: whatever -> Whatever ? + local language = data.language or "dflt" + local script = data.script or "dflt" + local direction = rlmode < 0 and "rtl" or "ltr" + local shaper = shapers[data.shaper] + local featurehash = data.features + local featuredata = featured[featurehash] + if not featuredata then + featuredata = loadfeatures(data) + featured[featurehash] = featuredata + end + + local buffer = ffi.gc(harfbuzz.hb_buffer_create(),harfbuzz.hb_buffer_destroy) + + -- if false then + -- -- i have no time to look into this now but something like this should + -- -- be possible .. it probably doesn't make a difference in performance + -- local n = 0 -- here we also start at 0 + -- if leading then + -- harfbuzz.hb_buffer_add(buffer,[todo: 0x20],n) + -- end + -- for i=1,#text do + -- n = n + 1 + -- harfbuzz.hb_buffer_add(buffer,[todo: text[i] ],n) + -- end + -- if trailing then + -- n = n + 1 + -- harfbuzz.hb_buffer_add(buffer,[todo: 0x20 ],n) + -- end + -- else + -- maybe also utf 8 clusters here like on the command line but i have no time + -- to figure that out + text = packtoutf32(text,leading,trailing) + local size = #text/4 + text = text .. "\000\000\000\000\000\000\000\000" -- trial and error: avoid crash + harfbuzz.hb_buffer_add_utf32(buffer,text,#text,0,size) + -- end + + -- maybe: hb_buffer_set_segment_properties(buffer,...) + + harfbuzz.hb_buffer_set_language(buffer,harfbuzz.hb_language_from_string(language,#language)) + harfbuzz.hb_buffer_set_script(buffer,harfbuzz.hb_script_from_string(script,#script)) + harfbuzz.hb_buffer_set_direction(buffer,harfbuzz.hb_direction_from_string(direction,#direction)) + + harfbuzz.hb_buffer_guess_segment_properties(buffer) -- why is this needed (we already set them) + harfbuzz.hb_shape_full(instance,buffer,featuredata.featurespec,featuredata.noffeatures,shaper) + + if rlmode < 0 then + harfbuzz.hb_buffer_reverse(buffer) + end + + local size = harfbuzz.hb_buffer_get_length(buffer) + local infos = harfbuzz.hb_buffer_get_glyph_infos(buffer, nil) + local positions = harfbuzz.hb_buffer_get_glyph_positions(buffer, nil) + + local result = { } + for i=1,size do + local info = infos[i-1] + local position = positions[i-1] + result[i] = { + info.codepoint, + info.cluster, + position.x_offset, + position.y_offset, + position.x_advance, + position.y_advance, + } + end + -- inspect(result) + return result + +end diff --git a/tex/context/base/mkiv/mlib-pps.lua b/tex/context/base/mkiv/mlib-pps.lua index 122ca6f99..c80777f5f 100644 --- a/tex/context/base/mkiv/mlib-pps.lua +++ b/tex/context/base/mkiv/mlib-pps.lua @@ -1463,6 +1463,8 @@ local function tr_process(object,prescript,before,after) sp_specs = concat(sp_specs,",") definemultitonecolor(sp_name,sp_specs,"","") sp_type = "named" + elseif sp_type == "named" then + cs = { 1 } -- factor 1 end if sp_type == "named" then -- we might move this to another namespace .. also, named can be a spotcolor diff --git a/tex/context/base/mkiv/page-imp.mkiv b/tex/context/base/mkiv/page-imp.mkiv index 829ed24f4..ec249d652 100644 --- a/tex/context/base/mkiv/page-imp.mkiv +++ b/tex/context/base/mkiv/page-imp.mkiv @@ -102,6 +102,15 @@ \installshipoutmethod \v!none {\page_shipouts_ignore} +% \setuppaper[method=rotate,rotation=15] \showframe +% \starttext \dorecurse{10}{\input knuth\endgraf} \stoptext + +\installshipoutmethod\v!rotate + {\page_shipouts_rotate} + +\protected\def\page_shipouts_rotate#1% + {\invokepagehandler\v!normal{\rotate[\c!rotation=\rootlayouttargetparameter\c!rotation]{#1}}} + % extension mechanism \newcount\c_page_boxes_flush_n % set at the lua end diff --git a/tex/context/base/mkiv/publ-imp-aps-prb.mkvi b/tex/context/base/mkiv/publ-imp-aps-prb.mkvi new file mode 100644 index 000000000..19735b949 --- /dev/null +++ b/tex/context/base/mkiv/publ-imp-aps-prb.mkvi @@ -0,0 +1,40 @@ +%D \module +%D [ file=publ-imp-aps-prb, +%D version=2015.03.22, +%D title=Phys. Rev. B APS bibliography style, +%D subtitle=Publications, +%D author=Alan Braslau and Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted +%D by \PRAGMA. See mreadme.pdf for details. + +\startbtxrenderingdefinitions[aps-prb] + +\loadbtxdefinitionfile[aps] + +\setupbtxlist + [aps] + [\c!alternative=\v!paragraph, + \c!width=\v!auto, + \c!distance=\zeropoint, + \c!numberalign=\v!flushright] + +\setupbtx + [aps:list:numbering:num] + [\c!command=\high, + \c!left=, + \c!right=, + \c!stopper=] + +\setupbtx + [aps:cite:num] + [\c!command=\high, + \c!left=, + \c!right=] + +%\setupbtx +% [\c!specification=aps] + +\stopbtxrenderingdefinitions diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 82fa2f6a3..96866e655 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 26b23cda0..8013acd66 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 70b47d75d..3fedf6b5b 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2021.07.21 19:51} +\newcontextversion{2021.07.22 19:11} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 67ecc671c..b517cf7b9 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2021.07.21 19:51} +\immutable\edef\contextversion{2021.07.22 19:11} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/core-uti.lmt b/tex/context/base/mkxl/core-uti.lmt new file mode 100644 index 000000000..1bb50060d --- /dev/null +++ b/tex/context/base/mkxl/core-uti.lmt @@ -0,0 +1,437 @@ +if not modules then modules = { } end modules ['core-uti'] = { + version = 1.001, + comment = "companion to core-uti.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +-- todo: keep track of changes here (hm, track access, and only true when +-- accessed and changed) + +--[[ldx-- +

A utility file has always been part of and with +the move to we also moved a lot of multi-pass info +to a table. Instead of loading a based +utility file under different setups, we now load a table once. This +saves much runtime but at the cost of more memory usage.

+--ldx]]-- + +local math = math +local format, match = string.format, string.match +local next, type, tostring, tonumber = next, type, tostring, tonumber +local concat = table.concat + +local definetable = utilities.tables.definetable +local accesstable = utilities.tables.accesstable +local migratetable = utilities.tables.migratetable +local serialize = table.serialize +local packers = utilities.packers +local allocate = utilities.storage.allocate +local mark = utilities.storage.mark + +local getrandom = utilities.randomizer.get +local setrandomseedi = utilities.randomizer.setseedi +local getrandomseed = utilities.randomizer.getseed + +local implement = interfaces.implement + +local texgetcount = tex.getcount + +local report_passes = logs.reporter("job","passes") + +job = job or { } +local job = job + +job.version = 1.32 +job.packversion = 1.02 + +-- some day we will implement loading of other jobs and then we need +-- job.jobs + +--[[ldx-- +

Variables are saved using in the previously defined table and passed +onto using the following method. Of course one can also +directly access the variable using a call.

+--ldx]]-- + +local savelist, comment = { }, { } + +function job.comment(key,value) + if type(key) == "table" then + for k, v in next, key do + comment[k] = v + end + else + comment[key] = value + end +end + +job.comment("version",job.version) + +local enabled = true +local initialized = false + +directives.register("job.save",function(v) enabled = v end) + +function job.disablesave() + enabled = false -- for instance called when an error +end + +function job.initialize(loadname,savename) + if not initialized then + if not loadname or loadname == "" then + loadname = tex.jobname .. ".tuc" + end + if not savename or savename == "" then + savename = tex.jobname .. ".tua" + end + job.load(loadname) -- has to come after structure is defined ! + luatex.registerstopactions(function() + if enabled then + job.save(savename) + end + end) + initialized = true + end +end + +function job.register(collected, tobesaved, initializer, finalizer, serializer) + savelist[#savelist+1] = { collected, tobesaved, initializer, finalizer, serializer } +end + +-- as an example we implement variables + +local tobesaved, collected, checksums = allocate(), allocate(), allocate() + +local jobvariables = { + collected = collected, + tobesaved = tobesaved, + checksums = checksums, +} + +-- if not checksums.old then checksums.old = md5.HEX("old") end -- used in experiment +-- if not checksums.new then checksums.new = md5.HEX("new") end -- used in experiment + +job.variables = jobvariables + +local function initializer() + checksums = jobvariables.checksums +end + +job.register('job.variables.checksums', 'job.variables.checksums', initializer) + +local rmethod, rvalue +local collectedmacros, tobesavedmacros + +local ctx_setxvalue = context.setxvalue + +local function initializer() + tobesaved = jobvariables.tobesaved + collected = jobvariables.collected + -- + rvalue = collected.randomseed + if not rvalue then + rvalue = getrandom("initialize") + setrandomseedi(rvalue) + rmethod = "initialized" + else + setrandomseedi(rvalue) + rmethod = "resumed" + end + tobesaved.randomseed = rvalue + -- + collectedmacros = collected.macros + tobesavedmacros = tobesaved.macros + if not collectedmacros then + collectedmacros = { } + collected.macros = collectedmacros + end + if not tobesavedmacros then + tobesavedmacros = { } + tobesaved.macros = tobesavedmacros + end + -- will become collected.macros + for cs, value in next, collectedmacros do + if type(value) == "string" then -- safeguard + ctx_setxvalue(cs,value) + end + end +end + +job.register('job.variables.collected', tobesaved, initializer) + +function jobvariables.save(cs,value) + tobesavedmacros[cs] = value +end + +function jobvariables.restore(cs) + return collectedmacros[cs] or tobesavedmacros[cs] +end + +function job.getrandomseed() + return tobesaved.randomseed or getrandomseed() +end + +-- checksums + +function jobvariables.getchecksum(tag) + return checksums[tag] -- no default +end + +function jobvariables.makechecksum(data) + return data and md5.HEX(data) -- no default +end + +function jobvariables.setchecksum(tag,checksum) + checksums[tag] = checksum +end + +-- + +local packlist = { + "numbers", + "ownnumbers", + "metadata", + "sectiondata", + "prefixdata", + "numberdata", + "pagedata", + "directives", + "specification", + "processors", -- might become key under directives or metadata +-- "references", -- we need to rename of them as only one packs (not structures.lists.references) +} + +local skiplist = { + "datasets", + "userdata", + "positions", +} + +-- not ok as we can have arbitrary keys in userdata and dataset so some day we +-- might need a bit more granularity, like skippers + +local jobpacker = packers.new(packlist,job.packversion,skiplist) -- jump number when changs in hash + +job.pack = true +-- job.pack = false + +directives.register("job.pack",function(v) job.pack = v end) + +local _save_, _load_, _others_ = { }, { }, { } -- registers timing + +function job.save(filename) -- we could return a table but it can get pretty large + statistics.starttiming(_save_) + local f = io.open(filename,'w') + if f then + f:write("local utilitydata = { }\n\n") + f:write(serialize(comment,"utilitydata.comment",true),"\n\n") + for l=1,#savelist do + -- f:write("do\n\n") -- no solution for the jit limitatione either + local list = savelist[l] + local target = format("utilitydata.%s",list[1]) + local data = list[2] + local finalizer = list[4] + local serializer = list[5] + if type(data) == "string" then + data = utilities.tables.accesstable(data) + end + if type(finalizer) == "function" then + finalizer() + end + if job.pack then + packers.pack(data,jobpacker,true) + end + local definer, name = definetable(target,true,true) -- no first and no last + if serializer then + f:write(definer,"\n\n",serializer(data,name,true),"\n\n") + else + f:write(definer,"\n\n",serialize(data,name,true),"\n\n") + end + -- f:write("end\n\n") + end + if job.pack then + packers.strip(jobpacker) + -- f:write("do\n\n") + f:write(serialize(jobpacker,"utilitydata.job.packed",true),"\n\n") + -- f:write("end\n\n") + end + f:write("return utilitydata") + f:close() + end + statistics.stoptiming(_save_) +end + +local function load(filename) + if lfs.isfile(filename) then + + local function dofile(filename) + local result = loadstring(io.loaddata(filename)) + if result then + return result() + else + return nil + end + end + + local okay, data = pcall(dofile,filename) + if okay and type(data) == "table" then + local jobversion = job.version + local datacomment = data.comment + local dataversion = datacomment and datacomment.version or "?" + if dataversion ~= jobversion then + report_passes("version mismatch: %s <> %s",dataversion,jobversion) + else + return data + end + else + os.remove(filename) -- probably a bad file (or luajit overflow as it cannot handle large tables well) + report_passes("removing stale job data file %a, restart job, message: %s%s",filename,tostring(data), + jit and " (try luatex instead of luajittex)" or "") + os.exit(true) -- trigger second run + end + end +end + +function job.load(filename) + statistics.starttiming(_load_) + local utilitydata = load(filename) + if utilitydata then + local jobpacker = utilitydata.job.packed + local handlers = { } + for i=1,#savelist do + local list = savelist[i] + local target = list[1] + local initializer = list[3] + local result = accesstable(target,utilitydata) + if result then + local done = packers.unpack(result,jobpacker,true) + if done then + migratetable(target,mark(result)) + if type(initializer) == "function" then + handlers[#handlers+1] = { initializer, result } + end + else + report_passes("pack version mismatch") + end + end + end + -- so we have all tables available (unpacked) + for i=1,#handlers do + local handler = handlers[i] + handler[1](handler[2]) + end + end + statistics.stoptiming(_load_) +end + +function job.loadother(filename) + statistics.starttiming(_load_) + _others_[#_others_+1] = file.nameonly(filename) + local utilitydata = load(filename) + if utilitydata then + local jobpacker = utilitydata.job.packed + local unpacked = { } + for l=1,#savelist do + local list = savelist[l] + local target = list[1] + local result = accesstable(target,utilitydata) + local done = packers.unpack(result,jobpacker,true) + if done then + migratetable(target,result,unpacked) + end + end + unpacked.job.packed = nil -- nicer in inspecting + return unpacked + end + statistics.stoptiming(_load_) +end + +statistics.register("startup time", function() + return statistics.elapsedseconds(statistics,"including runtime option file processing") +end) + +statistics.register("jobdata time",function() + if enabled then + if #_others_ > 0 then + return format("%s seconds saving, %s seconds loading, other files: %s",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_),concat(_others_," ")) + else + return format("%s seconds saving, %s seconds loading",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_)) + end + else + if #_others_ > 0 then + return format("nothing saved, %s seconds loading, other files: %s",statistics.elapsedtime(_load_),concat(_others_," ")) + else + return format("nothing saved, %s seconds loading",statistics.elapsedtime(_load_)) + end + end +end) + +statistics.register("callbacks", function() + local backend = backends.getcallbackstate() + local frontend = status.getcallbackstate() + local pages = structures.pages.nofpages or 0 + local total = frontend.count + backend.count + local average = pages > 0 and math.round(total/pages) or 0 + local result = format ( + "file: %s, saved: %s, direct: %s, function: %s, value: %s, message: %s, bytecode: %s, late %s, total: %s (%s per page)", + frontend.file, frontend.saved, frontend.direct, frontend["function"], + frontend.value, frontend.message, frontend.bytecode, backend.count, + total, average + ) + statistics.callbacks = function() + return result + end + return result +end) + +statistics.register("randomizer", function() + if rmethod and rvalue then + return format("%s with value %s",rmethod,rvalue) + end +end) + +function statistics.formatruntime(runtime) + if not environment.initex then -- else error when testing as not counters yet + -- stoptiming(statistics) -- to be sure + local shipped = texgetcount('nofshipouts') + local pages = texgetcount('realpageno') + if pages > shipped then + pages = shipped + end + runtime = tonumber(runtime) + if shipped > 0 or pages > 0 then + local persecond = (runtime > 0) and (shipped/runtime) or pages + if pages == 0 then + pages = shipped + end + return format("%0.3f seconds, %i processed pages, %i shipped pages, %.3f pages/second",runtime,pages,shipped,persecond) + else + return format("%0.3f seconds",runtime) + end + end +end + +implement { + name = "savecurrentvalue", + public = true, + actions = job.variables.save, + arguments = { "csname", "argument" }, +} + +implement { + name = "setjobcomment", + actions = job.comment, + arguments = { { "*" } } +} + +implement { + name = "initializejob", + actions = job.initialize +} + +implement { + name = "disablejobsave", + actions = job.disablesave +} diff --git a/tex/context/base/mkxl/core-uti.lua b/tex/context/base/mkxl/core-uti.lua deleted file mode 100644 index 887ef9a75..000000000 --- a/tex/context/base/mkxl/core-uti.lua +++ /dev/null @@ -1,470 +0,0 @@ -if not modules then modules = { } end modules ['core-uti'] = { - version = 1.001, - comment = "companion to core-uti.mkiv", - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - --- todo: keep track of changes here (hm, track access, and only true when --- accessed and changed) - ---[[ldx-- -

A utility file has always been part of and with -the move to we also moved a lot of multi-pass info -to a table. Instead of loading a based -utility file under different setups, we now load a table once. This -saves much runtime but at the cost of more memory usage.

---ldx]]-- - -local math = math -local format, match = string.format, string.match -local next, type, tostring, tonumber = next, type, tostring, tonumber -local concat = table.concat - -local definetable = utilities.tables.definetable -local accesstable = utilities.tables.accesstable -local migratetable = utilities.tables.migratetable -local serialize = table.serialize -local packers = utilities.packers -local allocate = utilities.storage.allocate -local mark = utilities.storage.mark - -local getrandom = utilities.randomizer.get -local setrandomseedi = utilities.randomizer.setseedi -local getrandomseed = utilities.randomizer.getseed - -local implement = interfaces.implement - -local texgetcount = tex.getcount - -local report_passes = logs.reporter("job","passes") - -job = job or { } -local job = job - -job.version = 1.32 -job.packversion = 1.02 - --- some day we will implement loading of other jobs and then we need --- job.jobs - ---[[ldx-- -

Variables are saved using in the previously defined table and passed -onto using the following method. Of course one can also -directly access the variable using a call.

---ldx]]-- - -local savelist, comment = { }, { } - -function job.comment(key,value) - if type(key) == "table" then - for k, v in next, key do - comment[k] = v - end - else - comment[key] = value - end -end - -job.comment("version",job.version) - -local enabled = true -local initialized = false - -directives.register("job.save",function(v) enabled = v end) - -function job.disablesave() - enabled = false -- for instance called when an error -end - -function job.initialize(loadname,savename) - if not initialized then - if not loadname or loadname == "" then - loadname = tex.jobname .. ".tuc" - end - if not savename or savename == "" then - savename = tex.jobname .. ".tua" - end - job.load(loadname) -- has to come after structure is defined ! - luatex.registerstopactions(function() - if enabled then - job.save(savename) - end - end) - initialized = true - end -end - -function job.register(collected, tobesaved, initializer, finalizer, serializer) - savelist[#savelist+1] = { collected, tobesaved, initializer, finalizer, serializer } -end - --- as an example we implement variables - -local tobesaved, collected, checksums = allocate(), allocate(), allocate() - -local jobvariables = { - collected = collected, - tobesaved = tobesaved, - checksums = checksums, -} - --- if not checksums.old then checksums.old = md5.HEX("old") end -- used in experiment --- if not checksums.new then checksums.new = md5.HEX("new") end -- used in experiment - -job.variables = jobvariables - -local function initializer() - checksums = jobvariables.checksums -end - -job.register('job.variables.checksums', 'job.variables.checksums', initializer) - -local rmethod, rvalue -local collectedmacros, tobesavedmacros - -local ctx_setxvalue = context.setxvalue - -local function initializer() - tobesaved = jobvariables.tobesaved - collected = jobvariables.collected - -- - rvalue = collected.randomseed - if not rvalue then - rvalue = getrandom("initialize") - setrandomseedi(rvalue) - rmethod = "initialized" - else - setrandomseedi(rvalue) - rmethod = "resumed" - end - tobesaved.randomseed = rvalue - -- - collectedmacros = collected.macros - tobesavedmacros = tobesaved.macros - if not collectedmacros then - collectedmacros = { } - collected.macros = collectedmacros - end - if not tobesavedmacros then - tobesavedmacros = { } - tobesaved.macros = tobesavedmacros - end - -- will become collected.macros - for cs, value in next, collectedmacros do - if type(value) == "string" then -- safeguard - ctx_setxvalue(cs,value) - end - end -end - -job.register('job.variables.collected', tobesaved, initializer) - -function jobvariables.save(cs,value) - tobesavedmacros[cs] = value -end - -function jobvariables.restore(cs) - return collectedmacros[cs] or tobesavedmacros[cs] -end - -function job.getrandomseed() - return tobesaved.randomseed or getrandomseed() -end - --- checksums - -function jobvariables.getchecksum(tag) - return checksums[tag] -- no default -end - -function jobvariables.makechecksum(data) - return data and md5.HEX(data) -- no default -end - -function jobvariables.setchecksum(tag,checksum) - checksums[tag] = checksum -end - --- - -local packlist = { - "numbers", - "ownnumbers", - "metadata", - "sectiondata", - "prefixdata", - "numberdata", - "pagedata", - "directives", - "specification", - "processors", -- might become key under directives or metadata --- "references", -- we need to rename of them as only one packs (not structures.lists.references) -} - -local skiplist = { - "datasets", - "userdata", - "positions", -} - --- not ok as we can have arbitrary keys in userdata and dataset so some day we --- might need a bit more granularity, like skippers - -local jobpacker = packers.new(packlist,job.packversion,skiplist) -- jump number when changs in hash - -job.pack = true --- job.pack = false - -directives.register("job.pack",function(v) job.pack = v end) - -local _save_, _load_, _others_ = { }, { }, { } -- registers timing - -function job.save(filename) -- we could return a table but it can get pretty large - statistics.starttiming(_save_) - local f = io.open(filename,'w') - if f then - f:write("local utilitydata = { }\n\n") - f:write(serialize(comment,"utilitydata.comment",true),"\n\n") - for l=1,#savelist do - -- f:write("do\n\n") -- no solution for the jit limitatione either - local list = savelist[l] - local target = format("utilitydata.%s",list[1]) - local data = list[2] - local finalizer = list[4] - local serializer = list[5] - if type(data) == "string" then - data = utilities.tables.accesstable(data) - end - if type(finalizer) == "function" then - finalizer() - end - if job.pack then - packers.pack(data,jobpacker,true) - end - local definer, name = definetable(target,true,true) -- no first and no last - if serializer then - f:write(definer,"\n\n",serializer(data,name,true),"\n\n") - else - f:write(definer,"\n\n",serialize(data,name,true),"\n\n") - end - -- f:write("end\n\n") - end - if job.pack then - packers.strip(jobpacker) - -- f:write("do\n\n") - f:write(serialize(jobpacker,"utilitydata.job.packed",true),"\n\n") - -- f:write("end\n\n") - end - f:write("return utilitydata") - f:close() - end - statistics.stoptiming(_save_) -end - -local function load(filename) - if lfs.isfile(filename) then - - local function dofile(filename) - local result = loadstring(io.loaddata(filename)) - if result then - return result() - else - return nil - end - end - - local okay, data = pcall(dofile,filename) - if okay and type(data) == "table" then - local jobversion = job.version - local datacomment = data.comment - local dataversion = datacomment and datacomment.version or "?" - if dataversion ~= jobversion then - report_passes("version mismatch: %s <> %s",dataversion,jobversion) - else - return data - end - else - os.remove(filename) -- probably a bad file (or luajit overflow as it cannot handle large tables well) - report_passes("removing stale job data file %a, restart job, message: %s%s",filename,tostring(data), - jit and " (try luatex instead of luajittex)" or "") - os.exit(true) -- trigger second run - end - end -end - -function job.load(filename) - statistics.starttiming(_load_) - local utilitydata = load(filename) - if utilitydata then - local jobpacker = utilitydata.job.packed - local handlers = { } - for i=1,#savelist do - local list = savelist[i] - local target = list[1] - local initializer = list[3] - local result = accesstable(target,utilitydata) - if result then - local done = packers.unpack(result,jobpacker,true) - if done then - migratetable(target,mark(result)) - if type(initializer) == "function" then - handlers[#handlers+1] = { initializer, result } - end - else - report_passes("pack version mismatch") - end - end - end - -- so we have all tables available (unpacked) - for i=1,#handlers do - local handler = handlers[i] - handler[1](handler[2]) - end - end - statistics.stoptiming(_load_) -end - -function job.loadother(filename) - statistics.starttiming(_load_) - _others_[#_others_+1] = file.nameonly(filename) - local utilitydata = load(filename) - if utilitydata then - local jobpacker = utilitydata.job.packed - local unpacked = { } - for l=1,#savelist do - local list = savelist[l] - local target = list[1] - local result = accesstable(target,utilitydata) - local done = packers.unpack(result,jobpacker,true) - if done then - migratetable(target,result,unpacked) - end - end - unpacked.job.packed = nil -- nicer in inspecting - return unpacked - end - statistics.stoptiming(_load_) -end - --- function job.keep(filename) --- local suffix = file.suffix(filename) --- local base = file.removesuffix(filename) --- if suffix == "" then --- suffix = "tuc" --- end --- for i=1,10 do --- local tmpname = format("%s-%s-%02d.tmp",base,suffix,i) --- if lfs.isfile(tmpname) then --- os.remove(tmpname) --- report_passes("removing %a",tmpname) --- end --- end --- if lfs.isfile(filename) then --- local tmpname = format("%s-%s-%02d.tmp",base,suffix,environment.currentrun or 1) --- report_passes("copying %a into %a",filename,tmpname) --- file.copy(filename,tmpname) --- else --- report_passes("no file %a, nothing kept",filename) --- end --- end - --- eventually this will end up in strc-ini - -statistics.register("startup time", function() - return statistics.elapsedseconds(statistics,"including runtime option file processing") -end) - -statistics.register("jobdata time",function() - if enabled then - if #_others_ > 0 then - return format("%s seconds saving, %s seconds loading, other files: %s",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_),concat(_others_," ")) - else - return format("%s seconds saving, %s seconds loading",statistics.elapsedtime(_save_),statistics.elapsedtime(_load_)) - end - else - if #_others_ > 0 then - return format("nothing saved, %s seconds loading, other files: %s",statistics.elapsedtime(_load_),concat(_others_," ")) - else - return format("nothing saved, %s seconds loading",statistics.elapsedtime(_load_)) - end - end -end) - -statistics.register("callbacks", function() - local c_internal = status.callbacks or 0 - local c_file = status.indirect_callbacks or 0 - local c_direct = status.direct_callbacks or 0 - local c_late = backends.getcallbackstate().count - local c_function = status.function_callbacks or 0 - local c_total = c_internal + c_file + c_direct + c_late + c_function - local n_pages = structures.pages.nofpages or 0 - local c_average = n_pages > 0 and math.round(c_total/n_pages) or 0 - local result = format ( - "internal: %s, file: %s, direct: %s, late: %s, function %s, total: %s (%s per page)", - c_internal, c_file, c_direct, c_late, c_function, c_total, c_average - ) - statistics.callbacks = function() - return result - end - return result -end) - -statistics.register("randomizer", function() - if rmethod and rvalue then - return format("%s with value %s",rmethod,rvalue) - end -end) - --- a sort of joke (for ctx meeting) - --- local kg_per_watt_per_second = 1 / 15000000 --- local watts_per_core = 50 --- local speedup_by_other_engine = 1.2 --- local used_wood_factor = watts_per_core * kg_per_watt_per_second / speedup_by_other_engine --- local used_wood_factor = (50 / 15000000) / 1.2 - - -function statistics.formatruntime(runtime) - if not environment.initex then -- else error when testing as not counters yet - -- stoptiming(statistics) -- to be sure - local shipped = texgetcount('nofshipouts') - local pages = texgetcount('realpageno') - if pages > shipped then - pages = shipped - end - runtime = tonumber(runtime) - if shipped > 0 or pages > 0 then - local persecond = (runtime > 0) and (shipped/runtime) or pages - if pages == 0 then - pages = shipped - end - return format("%0.3f seconds, %i processed pages, %i shipped pages, %.3f pages/second",runtime,pages,shipped,persecond) - else - return format("%0.3f seconds",runtime) - end - end -end - -implement { - name = "savevariable", - actions = job.variables.save, - arguments = "2 strings", -} - -implement { - name = "setjobcomment", - actions = job.comment, - arguments = { { "*" } } -} - -implement { - name = "initializejob", - actions = job.initialize -} - -implement { - name = "disablejobsave", - actions = job.disablesave -} diff --git a/tex/context/base/mkxl/meta-imp-kindergarten.mkxl b/tex/context/base/mkxl/meta-imp-kindergarten.mkxl new file mode 100644 index 000000000..6b2402bf0 --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-kindergarten.mkxl @@ -0,0 +1,118 @@ +%D \module +%D [ file=meta-imp-kindergarten, +%D version=2020.00.00, +%D title=\METAPOST\ Graphics, +%D subtitle=Kindergarten Math, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% \nopdfcompression + +%D For Arthur, who told me that about the urban legend that \CONTEXT\ can do only +%D kindergarten math. Somehow I'd forgotten top add this to the distribution + +\startMPcalculation{simplefun} + + pen KindergartenPen ; KindergartenPen := pencircle scaled 1 ; + + % 10 x 10 grid + + vardef KindergartenEqual = + draw image + ( + draw (2,6) -- (9,5) ; + draw (2,4) -- (8,3) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenEqual" + enddef ; + vardef KindergartenPlus = + draw image + ( + draw (1,4) -- (9,5) ; + draw (4,1) -- (5,8) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenPlus" + enddef ; + vardef KindergartenMinus = + draw image + ( + draw (1,5) -- (9,4) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenMinus" + enddef ; + vardef KindergartenTimes = + draw image + ( + draw (2,1) -- (9,8) ; + draw (8,1) -- (2,8) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenTimes" + enddef ; + vardef KindergartenDivided = + draw image + ( + draw (2,1) -- (8,9) ; + ) + shifted (0,-2) + withpen KindergartenPen + withcolor "KindergartenDivided" + enddef ; + + lmt_registerglyphs [ + name = "kindergarten", + units = 10, + % usecolor = true, + width = 10, + height = 8, + depth = 2, + ] ; + + lmt_registerglyph [ category = "kindergarten", unicode = "0x003D", + code = "KindergartenEqual" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x002B", + code = "KindergartenPlus" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x2212", + code = "KindergartenMinus" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x00D7", + code = "KindergartenTimes" + ] ; + lmt_registerglyph [ category = "kindergarten", unicode = "0x002F", + code = "KindergartenDivided" + ] ; + +\stopMPcalculation + +\definecolor[KindergartenEqual] [darkgreen] +\definecolor[KindergartenPlus] [darkred] +\definecolor[KindergartenMinus] [darkred] +\definecolor[KindergartenTimes] [darkblue] +\definecolor[KindergartenDivided][darkblue] + +\continueifinputfile{meta-imp-kindergarten.mkxl} + +\definefontfeature + [mathextra] + [metapost=kindergarten] + +\setupbodyfont[dejavu] + +\startTEXpage[offset=10pt] + $ y = 2 \times x + a - b / 3 $ \par + \hfill \infofont{kindergarten math} +\stopTEXpage diff --git a/tex/context/base/mkxl/meta-imp-placeholders.mkxl b/tex/context/base/mkxl/meta-imp-placeholders.mkxl new file mode 100644 index 000000000..aa48b814c --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-placeholders.mkxl @@ -0,0 +1,83 @@ +%D \module +%D [ file=meta-imp-placeholders, +%D version=2021.02.01, +%D title=\METAPOST\ Graphics, +%D subtitle=Missing Glyph Placeholders, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is a drop in for the already existing placeholder function. It could be made +%D more clever by hashing similar shapes but as this is mostly a diagnostic feature +%D we go a quick an ddirty two dimensional array. + +%D It is now mostly a file one can run to get an idea what the replace macro triggers +%D so I've added it to the distribution. + +% \startMPcalculation{simplefun} +% loadfile("mp-miss.mpxl") ; +% \stopMPcalculation +% +% \startluacode +% +% local chardata = characters.data +% local fontdata = fonts.hashes.identifiers +% local mapping = fonts.checkers.mapping +% +% function fonts.checkers.placeholder(font,char) +% local category = chardata[char].category or "lu" -- todo: unknown +% local fakedata = mapping[category] +% local tfmdata = fontdata[font] +% local units = tfmdata.parameters.units or 1000 +% local slant = (tfmdata.parameters.slant or 0)/65536 +% local scale = units/1000 +% local rawdata = tfmdata.shared and tfmdata.shared.rawdata +% local weight = (rawdata and rawdata.metadata and rawdata.metadata.pfmweight or 400)/400 +% local specification = { +% code = "MissingGlyph", +% scale = scale, +% slant = slant, +% weight = weight, +% namespace = font, +% shapes = { { shape = fakedata[1], color = fakedata[2] } }, +% } +% fonts.helpers.setmetaglyphs("missing", font, char, specification) +% end +% +% \stopluacode + +%D We enable the checker: + +% \enabletrackers[fonts.missing=replace] + +\replacemissingcharacters + +\continueifinputfile{meta-imp-placeholders.mkxl} + +% \enableexperiments[fonts.compact] + +% \showglyphs + +\startbuffer + \startlines[before=,after=] + \strut {\tf test \char 12345\ test \char 12346\ test} + \strut {\bf test \char 12345\ test \char 12346\ test} + \strut {\it test \char 12345\ test \char 12346\ test} + \strut {\bi test \char 12345\ test \char 12346\ test} + \strut {test ὀ ρ φ α ν ῖ ο ς test} + \stoplines +\stopbuffer + +\starttext + \startTEXpage[offset=2pt,strut=no] + \getbuffer + \switchtobodyfont[pagella] + \getbuffer + \switchtobodyfont[dejavu] + \getbuffer + \stopTEXpage +\stoptext diff --git a/tex/context/base/mkxl/meta-imp-txt.lmt b/tex/context/base/mkxl/meta-imp-txt.lmt new file mode 100644 index 000000000..e4b88bd36 --- /dev/null +++ b/tex/context/base/mkxl/meta-imp-txt.lmt @@ -0,0 +1,116 @@ +if not modules then modules = { } end modules ['meta-imp-txt'] = { + version = 1.001, + comment = "companion to meta-imp-txt.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files", +} + +local setmetatableindex = table.setmetatableindex + +local texset = tex.set + +local scan = mp.scan +local scannumeric = scan.numeric +local scaninteger = scan.integer +local scanboolean = scan.boolean +local scanstring = scan.string + +local expandmacro = token.expandmacro -- todo + +local bpfactor = number.dimenfactors.bp + +local metapost = metapost +metapost.parshapes = { } + +local parshapes = { } +local properties = { } + +-- initialize shapes to 0 hsize + +function metapost.parshapes.reset() + parshapes = { } + properties = { } +end + +function metapost.parshapes.next() + properties = { } + parshapes[#parshapes+1] = properties +end + +function metapost.parshapes.inspect() + inspect(parshapes) +end + +function metapost.parshapes.getshape(n) + return (parshapes and parshapes[n]) or parshapes or nil +end + +function metapost.parshapes.get(index,name) + local v = parshapes[index][name] + if type(v) == "boolean" then + context(v and 1 or 0) + else + context(v) + end +end + +function metapost.parshapes.wholeshape() -- maybe just collect them earlier + local t, n = { }, 0 + for i=1,#parshapes do + local s = parshapes[i].shape + if s then + for i=1,#s do + n = n + 1 + t[n] = s[i] + end + end + end + if n > 0 then + texset("parshape",t) + end +end + +metapost.registerscript("setparshapeproperty", function() + local k = scanstring() + if k == "line" then + local entry = properties.shape[scannumeric()] + local indent = scannumeric() / bpfactor + local width = scannumeric() / bpfactor + entry[1] = indent + entry[2] = width + elseif k == "lines" then + properties.lines = scaninteger() + properties.shape = setmetatableindex(function(t,k) + local v = { 0, properties.width or 0 } + t[k] = v + return v + end) + elseif k == "first" then + properties[k] = scanboolean() + elseif k == "inspect" then + inspect(properties) + else + properties[k] = scannumeric() / bpfactor + end +end) + +interfaces.implement { + name = "setparagraphmetashape", + public = true, + protected = true, + arguments = "optional", + actions = function(list) + if list and list ~= "" then + list = utilities.parsers.settings_to_array(list) + if #list > 0 then + metapost.parshapes.reset() + for i=1,#list do + metapost.parshapes.next() + expandmacro("spac_shapes_calculate","{"..list[i].."}") + end + metapost.parshapes.wholeshape() + end + end + end +} diff --git a/tex/context/base/mkxl/mlib-pps.lmt b/tex/context/base/mkxl/mlib-pps.lmt index cea8a179d..19535b070 100644 --- a/tex/context/base/mkxl/mlib-pps.lmt +++ b/tex/context/base/mkxl/mlib-pps.lmt @@ -1492,6 +1492,8 @@ local function tr_process(object,prescript,before,after) sp_specs = concat(sp_specs,",") definemultitonecolor(sp_name,sp_specs,"","") sp_type = "named" + elseif sp_type == "named" then + cs = { 1 } -- factor 1 end if sp_type == "named" then -- we might move this to another namespace .. also, named can be a spotcolor diff --git a/tex/context/base/mkxl/page-imp.mkxl b/tex/context/base/mkxl/page-imp.mkxl index 4ee7c159b..676313029 100644 --- a/tex/context/base/mkxl/page-imp.mkxl +++ b/tex/context/base/mkxl/page-imp.mkxl @@ -100,6 +100,15 @@ \installshipoutmethod \v!none {\page_shipouts_ignore} +% \setuppaper[method=rotate,rotation=15] \showframe +% \starttext \dorecurse{10}{\input knuth\endgraf} \stoptext + +\installshipoutmethod\v!rotate + {\page_shipouts_rotate} + +\protected\def\page_shipouts_rotate#1% + {\invokepagehandler\v!normal{\rotate[\c!rotation=\rootlayouttargetparameter\c!rotation]{#1}}} + % extension mechanism \newcount\c_page_boxes_flush_n % set at the lua end diff --git a/tex/context/base/mkxl/typo-bld.lmt b/tex/context/base/mkxl/typo-bld.lmt index 9bd5172e7..d9cd78385 100644 --- a/tex/context/base/mkxl/typo-bld.lmt +++ b/tex/context/base/mkxl/typo-bld.lmt @@ -176,7 +176,7 @@ local function processor(head,followed_by_display) -- todo: not again in otr so we need to flag if enabled then starttiming(parbuilders) - head = actions(head,followed_by_display) + head = tonode(actions(tonut(head),followed_by_display)) stoptiming(parbuilders) return head else diff --git a/tex/context/modules/common/s-abbreviations-extras.tex b/tex/context/modules/common/s-abbreviations-extras.tex deleted file mode 100644 index 7ee6e1553..000000000 --- a/tex/context/modules/common/s-abbreviations-extras.tex +++ /dev/null @@ -1,56 +0,0 @@ -%D \module -%D [ file=s-abbrevations-extras.tex, % was: s-abr-01 -%D version=1996.01.01, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviated Extras, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\startmodule[abbreviations-extras] - -\def\SystemSpecialA#1{$\langle\it#1\rangle$} -\def\SystemSpecialB#1{{\tttf<#1>}} - -\unexpanded\def\CATCODE {\SystemSpecialA{catcode}} -\unexpanded\def\CATCODES {\SystemSpecialA{catcodes}} -\unexpanded\def\DIMENSION {\SystemSpecialA{dimension}} -\unexpanded\def\DIMENSIONS {\SystemSpecialA{dimensions}} -\unexpanded\def\COUNTER {\SystemSpecialA{counter}} -\unexpanded\def\COUNTERS {\SystemSpecialA{counters}} -\unexpanded\def\HBOX {\SystemSpecialA{hbox}} -\unexpanded\def\HBOXES {\SystemSpecialA{hboxes}} -\unexpanded\def\VBOX {\SystemSpecialA{vbox}} -\unexpanded\def\VBOXES {\SystemSpecialA{vboxes}} -\unexpanded\def\BOX {\SystemSpecialA{box}} -\unexpanded\def\BOXES {\SystemSpecialA{boxes}} -\unexpanded\def\TOKENLIST {\SystemSpecialA{token list}} -\unexpanded\def\TOKENLISTS {\SystemSpecialA{token lists}} -\unexpanded\def\NEWLINE {\SystemSpecialA{newline}} -\unexpanded\def\SKIP {\SystemSpecialA{skip}} -\unexpanded\def\SKIPS {\SystemSpecialA{skips}} -\unexpanded\def\MUSKIP {\SystemSpecialA{muskip}} -\unexpanded\def\MUSKIPS {\SystemSpecialA{muskips}} -\unexpanded\def\MARK {\SystemSpecialA{mark}} -\unexpanded\def\MARKS {\SystemSpecialA{marks}} - -\unexpanded\def\SPACE {\SystemSpecialB{space}} -\unexpanded\def\EOF {\SystemSpecialB{eof}} -\unexpanded\def\TAB {\SystemSpecialB{tab}} -\unexpanded\def\NEWPAGE {\SystemSpecialB{newpage}} -\unexpanded\def\NEWLINE {\SystemSpecialB{newline}} - -\unexpanded\def\LUWATEEKH {لُواتيخ} % kh ī t ā w [u] l -\unexpanded\def\luwateekh {luwātīkh} - -\doifmodeelse {mkiv} { - \unexpanded\def\THANH{H\agrave n Th\ecircumflexacute\ Th\agrave nh} -} { - \unexpanded\def\THANH{H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh} -} - -\stopmodule diff --git a/tex/context/modules/common/s-abbreviations-logos.tex b/tex/context/modules/common/s-abbreviations-logos.tex deleted file mode 100644 index dfac57f0a..000000000 --- a/tex/context/modules/common/s-abbreviations-logos.tex +++ /dev/null @@ -1,376 +0,0 @@ -%D \module -%D [ file=s-abbrevations-logos.tex, % was: s-abr-01 -%D version=1996.01.01, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviated Logos, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -% avoid two character abbreviations - -\startmodule[abbreviations-logos] - -\logo [MKI] {MkI} % joke -\logo [MKII] {MkII} -\logo [MKIII] {MkIII} % joke -\logo [MKIV] {MkIV} -\logo [MKVI] {MkVI} -\logo [MKIX] {MkIX} -\logo [MKXI] {MkXI} -\logo [MKXL] {MkXL} -\logo [MKLX] {MkLX} -\logo [MPII] {MpII} -\logo [MPIV] {MpIV} -\logo [MPVI] {MpVI} -\logo [MPLX] {MpLX} -\logo [MPXL] {MpXL} -\logo [LMTX] {LMTX} - -\logo [ACROBAT] {Acro\-bat} -\logo [AFM] {afm} -\logo [AI] {ai} -\logo [ALEPH] {Aleph} % {\mathematics{\aleph}} -\logo [ALGOL] {ALGOL} -\logo [AMS] {ams} -\logo [AMSLATEX] {\AmSLaTeX} -\logo [AMSTEX] {\AmSTeX} -\logo [ANSI] {ansi} -\logo [APA] {apa} -\logo [API] {api} -\logo [ARABTEX] {Arab\TeXsuffix} -\logo [ARM] {arm} -\logo [ASCII] {ascii} -\logo [ASCIIMATH] {AsciiMath} -\logo [ASCIITEX] {ascii\TeXsuffix} -\logo [BACHOTEX] {Bacho\TeXsuffix} -\logo [BASIC] {Basic} -\logo [BIBTEX] {bib\TeXsuffix} -\logo [BLUESKY] {BlueSky} -\logo [BMP] {bmp} -\logo [BSD] {bsd} -\logo [CALCMATH] {CalcMath} -\logo [CCODE] {C} -\logo [CD] {cd} -\logo [CDROM] {cdrom} -\logo [CID] {cid} -\logo [CJK] {cjk} -\logo [CLANG] {clang} -\logo [CLD] {cld} -\logo [CMAKE] {cmake} -\logo [CMR] {cmr} -\logo [CMYK] {cmyk} -\logo [CNC] {cnc} -\logo [CODHOST] {CodHost} -\logo [CONTEXT] {\ConTeXt} -\logo [CONTEXTGROUP] {\ConTeXt\ Group} -\logo [CONTEXTWIKI] {\ConTeXt\ Wiki} -\logo [CPLUSPLUS] {C\high{++}} -\logo [CPU] {cpu} -\logo [CSS] {css} -\logo [CSV] {csv} -\logo [CTAN] {ctan} -\logo [CTXTOOLS] {ctxtools} -\logo [CURL] {Curl} -\logo [CWEB] {cweb} -\logo [DAC] {dac} -\logo [DARWIN] {Darwin} -\logo [DECTEN] {dec-10} -\logo [DISTILLER] {distiller} -\logo [DNA] {dna} -\logo [DPI] {dpi} -%logo [DRATEX] {Dra\TeXsuffix} -\logo [DSC] {dsc} -\logo [DTD] {dtd} -\logo [DTK] {dtk} -\logo [DTP] {dtp} -\logo [DVD] {dvd} -\logo [DVI] {dvi} -\logo [DVIPDFM] {dvipdfm} -\logo [DVIPDFMX] {dvipdfmx} -\logo [DVIPOS] {dvipos} -\logo [DVIPS] {dvips} -\logo [DVIPSONE] {dvipsone} -\logo [DVISCR] {dviscr} -\logo [DVIWINDO] {dviwindo} -\logo [EBCDIC] {ebcdic} -\logo [EC] {ec} -\logo [ECMASCRIPT] {ecmascript} -\logo [EIFFEL] {Eiffel} -\logo [EMACS] {emacs} -\logo [EMTEX] {em\TeXsuffix} -\logo [ENCODING] {enc} -\logo [ENCTEX] {enc\TeXsuffix} -\logo [EPS] {eps} -\logo [EPUB] {ePub} -\logo [ETEX] {\eTeX} -\logo [EU] {eu} -\logo [EUROBACHOTEX] {EuroBacho\TeXsuffix} -\logo [EUROMATH] {EuroMath} -\logo [EUROTEX] {Euro\TeXsuffix} -\logo [EXAMPLE] {eXaMpLe} -\logo [EXAMPLED] {exampled} -\logo [EXAMPLEQ] {exampleq} -\logo [EXAMPLER] {exampler} -\logo [EXAMPLET] {examplet} -\logo [EXAMPLEX] {examplex} -\logo [EXIMPLE] {eXiMpLe} -\logo [FAQ] {faq} -\logo [FDF] {fdf} -\logo [FFI] {ffi} -%logo [FGA] {fga} -%logo [FGBBS] {fgbbs} -\logo [FLAC] {flac} -\logo [FONTFORGE] {FontForge} -\logo [FOXET] {foXet} -\logo [FPTEX] {fp\TeXsuffix} -\logo [FREEBSD] {FreeBSD} -\logo [FTP] {ftp} -\logo [GCC] {gcc} -\logo [GHOSTSCRIPT] {Ghost\-script} -\logo [GHOSTVIEW] {Ghost\-view} -\logo [GIF] {gif} -\logo [GNU] {gnu} -\logo [GNUPLOT] {gnuplot} -\logo [GRAPHICSMAGICK]{GraphicsMagick} -\logo [GS] {Ghost\-Script} -\logo [GUST] {Gust} -\logo [GWTEX] {gw\TeXsuffix} -\logo [HSB] {hsb} % ? -\logo [HSV] {hsv} -\logo [HTML] {html} -\logo [HTTP] {http} -\logo [HTTPS] {https} -\logo [HZ] {hz} -\logo [IBM] {ibm} -\logo [IMAGEMAGICK] {ImageMagick} -\logo [INITEX] {ini\TeXsuffix} -\logo [INRSTEX] {inrs\TeXsuffix} -\logo [IO] {io} -\logo [INKSCAPE] {Inkscape} -\logo [IRCNET] {IRCnet} -\logo [ISO] {iso} -\logo [JAVA] {Java} -\logo [JAVASCRIPT] {Java\-Script} -\logo [JBIG] {jbig} -\logo [JIT] {jit} -\logo [JPEG] {jpeg} -\logo [JPG] {jpg} -\logo [JSON] {json} -\logo [KB] {KB} -\logo [KPATHSEA] {kpathsea} -\logo [KPSE] {kpse} -\logo [KPSEWHICH] {kpsewhich} -\logo [KVM] {kvm} -\logo [LAMSTEX] {\LamSTeX} -\logo [LATEX] {\LaTeX} -%logo [LATEXTE] {\LaTeX2e} -%logo [LATEXTN] {\LaTeX2.09} -\logo [LCD] {lcd} -\logo [LINUX] {linux} -\logo [LISP] {Lisp} -\logo [LMX] {lmx} -\logo [LPEG] {lpeg} -\logo [LUA] {Lua} -\logo [LUAJIT] {Lua\wordboundary JIT} -\logo [LUAJITTEX] {Lua\wordboundary jit\TeXsuffix} -\logo [LUAMETATEX] {\Lua\wordboundary Meta\wordboundary\TeXsuffix} -\logo [LUATEX] {Lua\wordboundary\TeXsuffix} -\logo [LUATOOLS] {luatools} -\logo [MACOSX] {MacOSX} -%logo [MACROTEX] {Macro\TeXsuffix} -\logo [MAKEMPY] {MakeMPY} -\logo [MAPPING] {map} -\logo [MAPS] {Maps} -\logo [MATHML] {MathML} -\logo [METAFONT] {\MetaFont} -\logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun} -\logo [METAFUN] {\MetaFun} -\logo [METAPOST] {\MetaPost} -\logo [METATEX] {Meta\TeXsuffix} -\logo [METATYPE] {MetaType1} -\logo [MICROSOFT] {Microsoft} -\logo [MIKTEX] {Mik\TeXsuffix} -\logo [MINGW] {MingW} -\logo [MKTEXLSR] {mktexlsr} -\logo [MLBIBTEX] {MLbib\TeXsuffix} -\logo [MLTEX] {ml\TeXsuffix} -\logo [MODULA] {Modula} -\logo [MOV] {mov} -\logo [MPEG] {mpeg} -\logo [MPLIB] {mplib} -\logo [MPS] {mps} -\logo [MPTOPDF] {mptopdf} -\logo [MSDOS] {msdos} -\logo [MSEXCEL] {MS~Excel} -\logo [MSVC] {MSVC} -\logo [MSWINDOWS] {MS~Windows} -\logo [MSWORD] {MS~Word} -\logo [MTXRUN] {mtxrun} -\logo [MTXTOOLS] {mtxtools} -\logo [MYSQL] {MySQL} -\logo [NETPBM] {NetPBM} -\logo [NGINX] {nginx} -\logo [NTG] {ntg} -\logo [NTS] {nts} -\logo [OFM] {ofm} -\logo [OMEGA] {Omega} -\logo [OPENBSD] {OpenBSD} -\logo [OPENMATH] {OpenMath} -\logo [OPENTYPE] {OpenType} -\logo [OPENOFFICE] {OpenOffice} -\logo [OPI] {opi} -\logo [OSX] {os-x} -\logo [OTEX] {Oriental \TeXsuffix} -\logo [OTF] {otf} -\logo [OTP] {otp} -\logo [OVF] {ovf} -\logo [PASCAL] {Pascal} -\logo [PATGEN] {Patgen} -\logo [PCTEX] {pc\TeXsuffix} -\logo [PDF] {pdf} -\logo [PDFETEX] {pdfe\TeXsuffix} -\logo [PDFTEX] {pdf\TeXsuffix} -\logo [PDFTOOLS] {pdftools} -\logo [PDFTOPS] {pdftops} -\logo [PERL] {Perl} -\logo [PERLTK] {Perl/Tk} -\logo [PFA] {pfa} -\logo [PFB] {pfb} -\logo [PICTEX] {\PiCTeX} -\logo [PK] {pk} -\logo [PLAIN] {Plain} -\logo [PNG] {png} -\logo [POSIX] {posix} -\logo [POSTGRESS] {Post\-gress} -\logo [POSTSCRIPT] {Post\-Script} -\logo [PPCHTEX] {\PPCHTeX} -\logo [PRAGMA] {Pragma ADE} -\logo [PRESS] {press} -\logo [PRIFIL] {prifil} -\logo [PS] {Post\-Script} -\logo [PSCHECK] {pscheck} -\logo [PSTOEDIT] {pstoedit} -\logo [PSTOPAGE] {pstopage} -\logo [PSTOPDF] {pstopdf} -\logo [PSTRICKS] {pstricks} -\logo [PYTHON] {Python} -\logo [RAID] {raid} -\logo [RAM] {ram} -\logo [RCA] {RCA} -\logo [READER] {Acro\-bat Reader} -\logo [RELAXNG] {Relax\kern.125emNG} -\logo [RGB] {rgb} -\logo [RLXTOOLS] {rlxtools} -\logo [RSYNC] {Rsync} -\logo [RUBY] {Ruby} -\logo [SCITE] {SciTE} -\logo [SGML] {sgml} -\logo [SI] {si} -\logo [SQL] {sql} -\logo [SSD] {ssd} -\logo [STIX] {Stix} -\logo [SUMATRAPDF] {SumatraPDF} -\logo [SVG] {svg} -\logo [SVN] {svn} -\logo [SWIG] {swig} -\logo [SWIGLIB] {SwigLib} -\logo [SYNCTEX] {Sync\TeX} -\logo [SQLITE] {SQLite} -\logo [TABLE] {\TaBlE} -\logo [TCPIP] {tcp/ip} -\logo [TDS] {tds} % no sc te -\logo [TEI] {tei} % no sc te -\logo [TETEX] {te\TeXsuffix} % no sc te -\logo [TEX] {\TeX} -\logo [TEXADRES] {\TeXprefix adress} -\logo [TEXBASE] {\TeXprefix base} -\logo [TEXEDIT] {\TeXprefix edit} -\logo [TEXEXEC] {\TeXprefix exec} -\logo [TEXFONT] {\TeXprefix font} -\logo [TEXFORM] {\TeXprefix form} -\logo [TEXGYRE] {\TeX\ Gyre} -\logo [TEXLIVE] {\TeXprefix Live} -\logo [TEXLUA] {\TeXprefix Lua} -\logo [TEXMF] {texmf} -\logo [TEXMFSTART] {texmfstart} -\logo [TEXNL] {tex-nl} -\logo [TEXSHOW] {\TeXprefix show} -\logo [TEXSPELL] {\TeXprefix spell} -\logo [TEXSYNC] {texsync} -\logo [TEXTMATE] {TextMate} -\logo [TEXTOOLS] {\TeXprefix tools} -\logo [TEXUTIL] {\TeXprefix util} -\logo [TEXWORK] {\TeXprefix work} -\logo [TEXWORKS] {\TeXprefix works} -\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT} -\logo [TFM] {tfm} -\logo [THREED] {3D} -\logo [TIF] {tif} -\logo [TIFF] {tiff} -\logo [TIFFINFO] {tiffinfo} -\logo [TIFFTAGS] {tifftags} -\logo [TMFTOOLS] {tmftools} -\logo [TPIC] {tpic} -\logo [TPM] {tpm} -\logo [TRUETYPE] {TrueType} -\logo [TTC] {ttc} -\logo [TTF] {ttf} -\logo [TUG] {tug} -\logo [TUGBOAT] {Tug\-Boat} -\logo [TUGNEWS] {Tug\-News} -\logo [TYPEONE] {Type1} -\logo [TYPETHREE] {Type3} -\logo [UCS] {ucs} -\logo [UNICODE] {Uni\-code} -\logo [UNIX] {Unix} -\logo [URI] {uri} -\logo [URL] {url} -\logo [USA] {usa} -\logo [USB] {usb} -\logo [USENET] {usenet} -\logo [UTF] {utf} -\logo [VAX] {vax} -\logo [VF] {vf} -\logo [VMWARE] {VMWare} -\logo [WDT] {wdt} -\logo [WEB] {web} -\logo [WEBC] {web2c} -\logo [WIKI] {Wiki} -\logo [WINDOWS] {Windows} -%logo [WINNT] {WinNT} -%logo [WINNX] {Win9x} -\logo [WTHREEC] {W3C} -\logo [WWW] {www} -\logo [WIKIPEDIA] {Wikipedia} % WikipediA (looks too weird) -\logo [WYSIWYG] {wysiwyg} -%logo [XDVI] {Xdvi} -\logo [XETEX] {\XeTeX} -\logo [XFDF] {xfdf} -\logo [XHTML] {xhtml} -\logo [XINDY] {Xindy} -\logo [XITS] {Xits} -\logo [XML] {xml} -\logo [XMLTOOLS] {xmltools} -\logo [XPATH] {xpath} -%logo [XPDFETEX] {xpdfe\TeXsuffix} -\logo [XSL] {xsl} -\logo [XSLFO] {xsl-fo} -\logo [XSLT] {xslt} -\logo [XSLTPROC] {xsltproc} -\logo [XYPIC] {XYPIC} % wrong logo -\logo [YandY] {y\&y} -\logo [YOUTUBE] {YouTube} -\logo [ZIP] {zip} -\logo [ZINT] {zint} - -\logo [KB] {KB} -\logo [MB] {MB} -\logo [GB] {GB} -% \logo [TB] {TB} - -\stopmodule diff --git a/tex/context/modules/common/s-abbreviations-mixed.mkiv b/tex/context/modules/common/s-abbreviations-mixed.mkiv deleted file mode 100644 index d5294fd56..000000000 --- a/tex/context/modules/common/s-abbreviations-mixed.mkiv +++ /dev/null @@ -1,28 +0,0 @@ -%D \module -%D [ file=s-abbreviations-mixed, % was: s-abr-04 -%D version=1996.01.01, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviations Mixed, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\setupsorting - [logo] - [\c!style=\font_style_pseudoMixedCapped] - -\protect - -\startmodule[abbreviations-mixed] - -\usemodule[abbreviations-logos] -\usemodule[abbreviations-extras] - -\stopmodule - diff --git a/tex/context/modules/common/s-abbreviations-pseudocaps.mkiv b/tex/context/modules/common/s-abbreviations-pseudocaps.mkiv deleted file mode 100644 index fa8606a7b..000000000 --- a/tex/context/modules/common/s-abbreviations-pseudocaps.mkiv +++ /dev/null @@ -1,30 +0,0 @@ -%D \module -%D [ file= s-abbreviations-pseudocaps, % was: s-abr-01 -%D version=1996.01.01, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviations Pseudocaps, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\setupsorting - [logo] - [\c!style=\v!capital] - -\setupcapitals - [\c!title=\v!no] - -\protect - -\startmodule[abbreviations-pseudocaps] - -\usemodule[abbreviations-logos] -\usemodule[abbreviations-extras] - -\stopmodule diff --git a/tex/context/modules/common/s-abbreviations-smallcaps.mkiv b/tex/context/modules/common/s-abbreviations-smallcaps.mkiv deleted file mode 100644 index 2ce86ca33..000000000 --- a/tex/context/modules/common/s-abbreviations-smallcaps.mkiv +++ /dev/null @@ -1,31 +0,0 @@ -%D \module -%D [ file= s-abbreviations-smallcaps, % was: s-abr-02 -%D version=1996.01.01, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviations Smallcaps, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\setupsorting - [logo] - [\c!style=\v!smallcaps] - -\setupcapitals - [\c!title=\v!no] - -\protect - -\startmodule[abbreviations-smallcaps] - -\usemodule[abbreviations-logos] -\usemodule[abbreviations-extras] - -\stopmodule - diff --git a/tex/context/modules/common/s-abbreviations-words.mkiv b/tex/context/modules/common/s-abbreviations-words.mkiv deleted file mode 100644 index 2b7d7cedc..000000000 --- a/tex/context/modules/common/s-abbreviations-words.mkiv +++ /dev/null @@ -1,28 +0,0 @@ -%D \module -%D [ file= s-abbreviations-words, % was: s-abr-32 -%D version=1998.08.10, -%D title=\CONTEXT\ Style File, -%D subtitle=General Abbreviations Words, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -\unprotect - -\setupsorting - [logo] - [\c!style=\v!WORD] - -\protect - -\startmodule[abbreviations-words] - -\usemodule[abbreviations-logos] -\usemodule[abbreviations-extras] - -\stopmodule - diff --git a/tex/context/modules/common/s-obsolete-tokens.mkiv b/tex/context/modules/common/s-obsolete-tokens.mkiv deleted file mode 100644 index 117282a60..000000000 --- a/tex/context/modules/common/s-obsolete-tokens.mkiv +++ /dev/null @@ -1,346 +0,0 @@ -%D \module -%D [ file=toks-tra, % was toks-ini -%D version=2007.03.03, -%D title=\CONTEXT\ Obsolete Modules, -%D subtitle=Tokens, -%D author=Hans Hagen, -%D date=\currentdate, -%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] -%C -%C This module is part of the \CONTEXT\ macro||package and is -%C therefore copyrighted by \PRAGMA. See mreadme.pdf for -%C details. - -%D The code here used to be in the \type {toks-tra} files which were made in -%D the real early days of \LUATEX\ and used in articles and presentations -%D about this engine. Because the code is used in manuals we keep it around -%D as module. - -\writestatus{loading}{ConTeXt Obsolete Modules / Tokens} - -%D This used to be in \type {toks-tra.lua}: - -\startluacode - -if not modules then modules = { } end modules ['s-obsolete-tokens'] = { - version = 1.001, - author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", - copyright = "PRAGMA ADE / ConTeXt Development Team", - license = "see context related readme files" -} - -local utfbyte, utfchar, utfvalues = utf.byte, utf.char, utf.values -local format, gsub = string.format, string.gsub -local tostring = tostring - -local tokens = tokens -local token = token -- the built in one -local tex = tex -local context = context -local commands = commands - -tokens.collectors = tokens.collectors or { } -local collectors = tokens.collectors - -collectors.data = collectors.data or { } -local collectordata = collectors.data - -collectors.registered = collectors.registered or { } -local registered = collectors.registered - -local report = logs.reporter("tokens","collectors") - --- todo: --- --- register : macros that will be expanded (only for demo-ing) --- flush : print back to tex --- test : fancy stuff - -local get_next_token = tokens.scanners.next -local create_token = tokens.create - -function collectors.install(tag,end_cs) - local data, d = { }, 0 - collectordata[tag] = data - end_cs = gsub(end_cs,"^\\","") - while true do - local t = get_next_token() - if t.csname == end_cs then - context[end_cs]() - return - else - d = d + 1 - data[d] = t - end - end -end - -local simple = { letter = "letter", other_char = "other" } - -function collectors.show(data) - -- We no longer have methods as we only used (in demos) method a - -- so there is no need to burden the core with this. We have a - -- different table anyway. - if type(data) == "string" then - data = collectordata[data] - end - if not data then - return - end - local ctx_NC = context.NC - local ctx_NR = context.NR - local ctx_bold = context.bold - local ctx_verbatim = context.verbatim - local function show(data) - for i=1,#data do - local tok = data[i] - if type(tok) == "table" then - show(tok) - else - local cmdname = tok.cmdname - local simple = simple[cmdname] - ctx_NC() - ctx_verbatim(simple or cmdname) - ctx_NC() - ctx_verbatim(simple and utfchar(tok.index) or tok.csname) - ctx_NC() - if tok.active then context("active ") end - if tok.expandable then context("expandable ") end - if tok.protected then context("protected ") end - ctx_NC() - ctx_NR() - end - end - end - context.starttabulate { "|Tl|Tc|Tl|" } - ctx_NC() ctx_bold("cmd") - ctx_NC() ctx_bold("meaning") - ctx_NC() ctx_bold("properties") - ctx_NC() ctx_NR() - context.HL() - show(data) - context.stoptabulate() -end - -local function printlist(data) - if data and #data > 0 then - report("not supported (yet): printing back to tex") - end -end - -tokens.printlist = printlist -- will change to another namespace - -function collectors.flush(tag) - printlist(collectordata[tag]) -end - -function collectors.test(tag,handle) - report("not supported (yet): testing") -end - -function collectors.register(name) - report("not supported (yet): registering") -end - --- -- old token code --- --- -- 1 = command, 2 = modifier (char), 3 = controlsequence id --- --- local create = token.create --- local csname_id = token.csname_id --- local command_id = token.command_id --- local command_name = token.command_name --- local get_next = token.get_next --- local expand = token.expand --- local csname_name = token.csname_name --- --- local function printlist(data) --- if data and #data > 0 then --- callbacks.push('token_filter', function () --- callbacks.pop('token_filter') -- tricky but the nil assignment helps --- return data --- end) --- end --- end --- --- tokens.printlist = printlist -- will change to another namespace --- --- function collectors.flush(tag) --- printlist(collectordata[tag]) --- end --- --- function collectors.register(name) --- registered[csname_id(name)] = name --- end --- --- local call = command_id("call") --- local letter = command_id("letter") --- local other = command_id("other_char") --- --- function collectors.install(tag,end_cs) --- local data, d = { }, 0 --- collectordata[tag] = data --- end_cs = gsub(end_cs,"^\\","") --- local endcs = csname_id(end_cs) --- while true do --- local t = get_next() --- local a, b = t[1], t[3] --- if b == endcs then --- context[end_cs]() --- return --- elseif a == call and registered[b] then --- expand() --- else --- d = d + 1 --- data[d] = t --- end --- end --- end --- --- function collectors.show(data) --- -- We no longer have methods as we only used (in demos) method a --- -- so there is no need to burden the core with this. --- if type(data) == "string" then --- data = collectordata[data] --- end --- if not data then --- return --- end --- local ctx_NC = context.NC --- local ctx_NR = context.NR --- local ctx_bold = context.bold --- local ctx_verbatim = context.verbatim --- context.starttabulate { "|T|Tr|cT|Tr|T|" } --- ctx_NC() ctx_bold("cmd") --- ctx_NC() ctx_bold("chr") --- ctx_NC() --- ctx_NC() ctx_bold("id") --- ctx_NC() ctx_bold("name") --- ctx_NC() ctx_NR() --- context.HL() --- for i=1,#data do --- local token = data[i] --- local cmd = token[1] --- local chr = token[2] --- local id = token[3] --- local name = command_name(token) --- ctx_NC() --- ctx_verbatim(name) --- ctx_NC() --- if tonumber(chr) >= 0 then --- ctx_verbatim(chr) --- end --- ctx_NC() --- if cmd == letter or cmd == other then --- ctx_verbatim(utfchar(chr)) --- end --- ctx_NC() --- if id > 0 then --- ctx_verbatim(id) --- end --- ctx_NC() --- if id > 0 then --- ctx_verbatim(csname_name(token) or "") --- end --- ctx_NC() ctx_NR() --- end --- context.stoptabulate() --- end --- --- function collectors.test(tag,handle) --- local t, w, tn, wn = { }, { }, 0, 0 --- handle = handle or collectors.defaultwords --- local tagdata = collectordata[tag] --- for k=1,#tagdata do --- local v = tagdata[k] --- if v[1] == letter then --- wn = wn + 1 --- w[wn] = v[2] --- else --- if wn > 0 then --- handle(t,w) --- wn = 0 --- end --- tn = tn + 1 --- t[tn] = v --- end --- end --- if wn > 0 then --- handle(t,w) --- end --- collectordata[tag] = t --- end - --- Interfacing: - -commands.collecttokens = collectors.install -commands.showtokens = collectors.show -commands.flushtokens = collectors.flush -commands.testtokens = collectors.test -commands.registertoken = collectors.register - --- Redundant: - --- function collectors.test(tag) --- printlist(collectordata[tag]) --- end - --- For old times sake: - -collectors.dowithwords = collectors.test - --- This is only used in old articles ... will move to a module: - -tokens.vbox = create_token("vbox") -tokens.hbox = create_token("hbox") -tokens.vtop = create_token("vtop") -tokens.bgroup = create_token(utfbyte("{"),1) -tokens.egroup = create_token(utfbyte("}"),2) - -tokens.letter = function(chr) return create_token(utfbyte(chr),11) end -tokens.other = function(chr) return create_token(utfbyte(chr),12) end - -tokens.letters = function(str) - local t, n = { }, 0 - for chr in utfvalues(str) do - n = n + 1 - t[n] = create_token(chr, 11) - end - return t -end - -function collectors.defaultwords(t,str) - if t then - local n = #t - n = n + 1 ; t[n] = tokens.bgroup - n = n + 1 ; t[n] = create_token("red") - for i=1,#str do - n = n + 1 ; t[n] = tokens.other('*') - end - n = n + 1 ; t[n] = tokens.egroup - end -end - -\stopluacode - -%D This used to be in \type {toks-tra.mkiv}: - -% used to be: \registerctxluafile{toks-tra}{} - -\unprotect - -%D Handy for manuals \unknown\ but not really used in practice, so it might -%D become a runtime loaded module instead. - -\unexpanded\def\starttokens [#1]{\ctxcommand{collecttokens("#1","stoptokens")}} - \let\stoptokens \relax -\unexpanded\def\flushtokens [#1]{\ctxcommand{flushtokens("#1")}} -\unexpanded\def\showtokens [#1]{\ctxcommand{showtokens("#1")}} -\unexpanded\def\testtokens [#1]{\ctxcommand{testtokens("#1")}} -\unexpanded\def\registertoken #1{\ctxcommand{registertoken("#1")}} - -\let\toks_show\showtokens % we also support the primitive - -\unexpanded\def\showtokens{\doifelsenextoptional\toks_show\normalshowtokens} - -\protect \endinput diff --git a/tex/context/modules/mkiv/s-abbreviations-extras.tex b/tex/context/modules/mkiv/s-abbreviations-extras.tex new file mode 100644 index 000000000..7ee6e1553 --- /dev/null +++ b/tex/context/modules/mkiv/s-abbreviations-extras.tex @@ -0,0 +1,56 @@ +%D \module +%D [ file=s-abbrevations-extras.tex, % was: s-abr-01 +%D version=1996.01.01, +%D title=\CONTEXT\ Style File, +%D subtitle=General Abbreviated Extras, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +\startmodule[abbreviations-extras] + +\def\SystemSpecialA#1{$\langle\it#1\rangle$} +\def\SystemSpecialB#1{{\tttf<#1>}} + +\unexpanded\def\CATCODE {\SystemSpecialA{catcode}} +\unexpanded\def\CATCODES {\SystemSpecialA{catcodes}} +\unexpanded\def\DIMENSION {\SystemSpecialA{dimension}} +\unexpanded\def\DIMENSIONS {\SystemSpecialA{dimensions}} +\unexpanded\def\COUNTER {\SystemSpecialA{counter}} +\unexpanded\def\COUNTERS {\SystemSpecialA{counters}} +\unexpanded\def\HBOX {\SystemSpecialA{hbox}} +\unexpanded\def\HBOXES {\SystemSpecialA{hboxes}} +\unexpanded\def\VBOX {\SystemSpecialA{vbox}} +\unexpanded\def\VBOXES {\SystemSpecialA{vboxes}} +\unexpanded\def\BOX {\SystemSpecialA{box}} +\unexpanded\def\BOXES {\SystemSpecialA{boxes}} +\unexpanded\def\TOKENLIST {\SystemSpecialA{token list}} +\unexpanded\def\TOKENLISTS {\SystemSpecialA{token lists}} +\unexpanded\def\NEWLINE {\SystemSpecialA{newline}} +\unexpanded\def\SKIP {\SystemSpecialA{skip}} +\unexpanded\def\SKIPS {\SystemSpecialA{skips}} +\unexpanded\def\MUSKIP {\SystemSpecialA{muskip}} +\unexpanded\def\MUSKIPS {\SystemSpecialA{muskips}} +\unexpanded\def\MARK {\SystemSpecialA{mark}} +\unexpanded\def\MARKS {\SystemSpecialA{marks}} + +\unexpanded\def\SPACE {\SystemSpecialB{space}} +\unexpanded\def\EOF {\SystemSpecialB{eof}} +\unexpanded\def\TAB {\SystemSpecialB{tab}} +\unexpanded\def\NEWPAGE {\SystemSpecialB{newpage}} +\unexpanded\def\NEWLINE {\SystemSpecialB{newline}} + +\unexpanded\def\LUWATEEKH {لُواتيخ} % kh ī t ā w [u] l +\unexpanded\def\luwateekh {luwātīkh} + +\doifmodeelse {mkiv} { + \unexpanded\def\THANH{H\agrave n Th\ecircumflexacute\ Th\agrave nh} +} { + \unexpanded\def\THANH{H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh} +} + +\stopmodule diff --git a/tex/context/modules/mkiv/s-abbreviations-logos.tex b/tex/context/modules/mkiv/s-abbreviations-logos.tex new file mode 100644 index 000000000..dfac57f0a --- /dev/null +++ b/tex/context/modules/mkiv/s-abbreviations-logos.tex @@ -0,0 +1,376 @@ +%D \module +%D [ file=s-abbrevations-logos.tex, % was: s-abr-01 +%D version=1996.01.01, +%D title=\CONTEXT\ Style File, +%D subtitle=General Abbreviated Logos, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +% avoid two character abbreviations + +\startmodule[abbreviations-logos] + +\logo [MKI] {MkI} % joke +\logo [MKII] {MkII} +\logo [MKIII] {MkIII} % joke +\logo [MKIV] {MkIV} +\logo [MKVI] {MkVI} +\logo [MKIX] {MkIX} +\logo [MKXI] {MkXI} +\logo [MKXL] {MkXL} +\logo [MKLX] {MkLX} +\logo [MPII] {MpII} +\logo [MPIV] {MpIV} +\logo [MPVI] {MpVI} +\logo [MPLX] {MpLX} +\logo [MPXL] {MpXL} +\logo [LMTX] {LMTX} + +\logo [ACROBAT] {Acro\-bat} +\logo [AFM] {afm} +\logo [AI] {ai} +\logo [ALEPH] {Aleph} % {\mathematics{\aleph}} +\logo [ALGOL] {ALGOL} +\logo [AMS] {ams} +\logo [AMSLATEX] {\AmSLaTeX} +\logo [AMSTEX] {\AmSTeX} +\logo [ANSI] {ansi} +\logo [APA] {apa} +\logo [API] {api} +\logo [ARABTEX] {Arab\TeXsuffix} +\logo [ARM] {arm} +\logo [ASCII] {ascii} +\logo [ASCIIMATH] {AsciiMath} +\logo [ASCIITEX] {ascii\TeXsuffix} +\logo [BACHOTEX] {Bacho\TeXsuffix} +\logo [BASIC] {Basic} +\logo [BIBTEX] {bib\TeXsuffix} +\logo [BLUESKY] {BlueSky} +\logo [BMP] {bmp} +\logo [BSD] {bsd} +\logo [CALCMATH] {CalcMath} +\logo [CCODE] {C} +\logo [CD] {cd} +\logo [CDROM] {cdrom} +\logo [CID] {cid} +\logo [CJK] {cjk} +\logo [CLANG] {clang} +\logo [CLD] {cld} +\logo [CMAKE] {cmake} +\logo [CMR] {cmr} +\logo [CMYK] {cmyk} +\logo [CNC] {cnc} +\logo [CODHOST] {CodHost} +\logo [CONTEXT] {\ConTeXt} +\logo [CONTEXTGROUP] {\ConTeXt\ Group} +\logo [CONTEXTWIKI] {\ConTeXt\ Wiki} +\logo [CPLUSPLUS] {C\high{++}} +\logo [CPU] {cpu} +\logo [CSS] {css} +\logo [CSV] {csv} +\logo [CTAN] {ctan} +\logo [CTXTOOLS] {ctxtools} +\logo [CURL] {Curl} +\logo [CWEB] {cweb} +\logo [DAC] {dac} +\logo [DARWIN] {Darwin} +\logo [DECTEN] {dec-10} +\logo [DISTILLER] {distiller} +\logo [DNA] {dna} +\logo [DPI] {dpi} +%logo [DRATEX] {Dra\TeXsuffix} +\logo [DSC] {dsc} +\logo [DTD] {dtd} +\logo [DTK] {dtk} +\logo [DTP] {dtp} +\logo [DVD] {dvd} +\logo [DVI] {dvi} +\logo [DVIPDFM] {dvipdfm} +\logo [DVIPDFMX] {dvipdfmx} +\logo [DVIPOS] {dvipos} +\logo [DVIPS] {dvips} +\logo [DVIPSONE] {dvipsone} +\logo [DVISCR] {dviscr} +\logo [DVIWINDO] {dviwindo} +\logo [EBCDIC] {ebcdic} +\logo [EC] {ec} +\logo [ECMASCRIPT] {ecmascript} +\logo [EIFFEL] {Eiffel} +\logo [EMACS] {emacs} +\logo [EMTEX] {em\TeXsuffix} +\logo [ENCODING] {enc} +\logo [ENCTEX] {enc\TeXsuffix} +\logo [EPS] {eps} +\logo [EPUB] {ePub} +\logo [ETEX] {\eTeX} +\logo [EU] {eu} +\logo [EUROBACHOTEX] {EuroBacho\TeXsuffix} +\logo [EUROMATH] {EuroMath} +\logo [EUROTEX] {Euro\TeXsuffix} +\logo [EXAMPLE] {eXaMpLe} +\logo [EXAMPLED] {exampled} +\logo [EXAMPLEQ] {exampleq} +\logo [EXAMPLER] {exampler} +\logo [EXAMPLET] {examplet} +\logo [EXAMPLEX] {examplex} +\logo [EXIMPLE] {eXiMpLe} +\logo [FAQ] {faq} +\logo [FDF] {fdf} +\logo [FFI] {ffi} +%logo [FGA] {fga} +%logo [FGBBS] {fgbbs} +\logo [FLAC] {flac} +\logo [FONTFORGE] {FontForge} +\logo [FOXET] {foXet} +\logo [FPTEX] {fp\TeXsuffix} +\logo [FREEBSD] {FreeBSD} +\logo [FTP] {ftp} +\logo [GCC] {gcc} +\logo [GHOSTSCRIPT] {Ghost\-script} +\logo [GHOSTVIEW] {Ghost\-view} +\logo [GIF] {gif} +\logo [GNU] {gnu} +\logo [GNUPLOT] {gnuplot} +\logo [GRAPHICSMAGICK]{GraphicsMagick} +\logo [GS] {Ghost\-Script} +\logo [GUST] {Gust} +\logo [GWTEX] {gw\TeXsuffix} +\logo [HSB] {hsb} % ? +\logo [HSV] {hsv} +\logo [HTML] {html} +\logo [HTTP] {http} +\logo [HTTPS] {https} +\logo [HZ] {hz} +\logo [IBM] {ibm} +\logo [IMAGEMAGICK] {ImageMagick} +\logo [INITEX] {ini\TeXsuffix} +\logo [INRSTEX] {inrs\TeXsuffix} +\logo [IO] {io} +\logo [INKSCAPE] {Inkscape} +\logo [IRCNET] {IRCnet} +\logo [ISO] {iso} +\logo [JAVA] {Java} +\logo [JAVASCRIPT] {Java\-Script} +\logo [JBIG] {jbig} +\logo [JIT] {jit} +\logo [JPEG] {jpeg} +\logo [JPG] {jpg} +\logo [JSON] {json} +\logo [KB] {KB} +\logo [KPATHSEA] {kpathsea} +\logo [KPSE] {kpse} +\logo [KPSEWHICH] {kpsewhich} +\logo [KVM] {kvm} +\logo [LAMSTEX] {\LamSTeX} +\logo [LATEX] {\LaTeX} +%logo [LATEXTE] {\LaTeX2e} +%logo [LATEXTN] {\LaTeX2.09} +\logo [LCD] {lcd} +\logo [LINUX] {linux} +\logo [LISP] {Lisp} +\logo [LMX] {lmx} +\logo [LPEG] {lpeg} +\logo [LUA] {Lua} +\logo [LUAJIT] {Lua\wordboundary JIT} +\logo [LUAJITTEX] {Lua\wordboundary jit\TeXsuffix} +\logo [LUAMETATEX] {\Lua\wordboundary Meta\wordboundary\TeXsuffix} +\logo [LUATEX] {Lua\wordboundary\TeXsuffix} +\logo [LUATOOLS] {luatools} +\logo [MACOSX] {MacOSX} +%logo [MACROTEX] {Macro\TeXsuffix} +\logo [MAKEMPY] {MakeMPY} +\logo [MAPPING] {map} +\logo [MAPS] {Maps} +\logo [MATHML] {MathML} +\logo [METAFONT] {\MetaFont} +\logo [LUAMETAFUN] {\Lua\wordboundary\MetaFun} +\logo [METAFUN] {\MetaFun} +\logo [METAPOST] {\MetaPost} +\logo [METATEX] {Meta\TeXsuffix} +\logo [METATYPE] {MetaType1} +\logo [MICROSOFT] {Microsoft} +\logo [MIKTEX] {Mik\TeXsuffix} +\logo [MINGW] {MingW} +\logo [MKTEXLSR] {mktexlsr} +\logo [MLBIBTEX] {MLbib\TeXsuffix} +\logo [MLTEX] {ml\TeXsuffix} +\logo [MODULA] {Modula} +\logo [MOV] {mov} +\logo [MPEG] {mpeg} +\logo [MPLIB] {mplib} +\logo [MPS] {mps} +\logo [MPTOPDF] {mptopdf} +\logo [MSDOS] {msdos} +\logo [MSEXCEL] {MS~Excel} +\logo [MSVC] {MSVC} +\logo [MSWINDOWS] {MS~Windows} +\logo [MSWORD] {MS~Word} +\logo [MTXRUN] {mtxrun} +\logo [MTXTOOLS] {mtxtools} +\logo [MYSQL] {MySQL} +\logo [NETPBM] {NetPBM} +\logo [NGINX] {nginx} +\logo [NTG] {ntg} +\logo [NTS] {nts} +\logo [OFM] {ofm} +\logo [OMEGA] {Omega} +\logo [OPENBSD] {OpenBSD} +\logo [OPENMATH] {OpenMath} +\logo [OPENTYPE] {OpenType} +\logo [OPENOFFICE] {OpenOffice} +\logo [OPI] {opi} +\logo [OSX] {os-x} +\logo [OTEX] {Oriental \TeXsuffix} +\logo [OTF] {otf} +\logo [OTP] {otp} +\logo [OVF] {ovf} +\logo [PASCAL] {Pascal} +\logo [PATGEN] {Patgen} +\logo [PCTEX] {pc\TeXsuffix} +\logo [PDF] {pdf} +\logo [PDFETEX] {pdfe\TeXsuffix} +\logo [PDFTEX] {pdf\TeXsuffix} +\logo [PDFTOOLS] {pdftools} +\logo [PDFTOPS] {pdftops} +\logo [PERL] {Perl} +\logo [PERLTK] {Perl/Tk} +\logo [PFA] {pfa} +\logo [PFB] {pfb} +\logo [PICTEX] {\PiCTeX} +\logo [PK] {pk} +\logo [PLAIN] {Plain} +\logo [PNG] {png} +\logo [POSIX] {posix} +\logo [POSTGRESS] {Post\-gress} +\logo [POSTSCRIPT] {Post\-Script} +\logo [PPCHTEX] {\PPCHTeX} +\logo [PRAGMA] {Pragma ADE} +\logo [PRESS] {press} +\logo [PRIFIL] {prifil} +\logo [PS] {Post\-Script} +\logo [PSCHECK] {pscheck} +\logo [PSTOEDIT] {pstoedit} +\logo [PSTOPAGE] {pstopage} +\logo [PSTOPDF] {pstopdf} +\logo [PSTRICKS] {pstricks} +\logo [PYTHON] {Python} +\logo [RAID] {raid} +\logo [RAM] {ram} +\logo [RCA] {RCA} +\logo [READER] {Acro\-bat Reader} +\logo [RELAXNG] {Relax\kern.125emNG} +\logo [RGB] {rgb} +\logo [RLXTOOLS] {rlxtools} +\logo [RSYNC] {Rsync} +\logo [RUBY] {Ruby} +\logo [SCITE] {SciTE} +\logo [SGML] {sgml} +\logo [SI] {si} +\logo [SQL] {sql} +\logo [SSD] {ssd} +\logo [STIX] {Stix} +\logo [SUMATRAPDF] {SumatraPDF} +\logo [SVG] {svg} +\logo [SVN] {svn} +\logo [SWIG] {swig} +\logo [SWIGLIB] {SwigLib} +\logo [SYNCTEX] {Sync\TeX} +\logo [SQLITE] {SQLite} +\logo [TABLE] {\TaBlE} +\logo [TCPIP] {tcp/ip} +\logo [TDS] {tds} % no sc te +\logo [TEI] {tei} % no sc te +\logo [TETEX] {te\TeXsuffix} % no sc te +\logo [TEX] {\TeX} +\logo [TEXADRES] {\TeXprefix adress} +\logo [TEXBASE] {\TeXprefix base} +\logo [TEXEDIT] {\TeXprefix edit} +\logo [TEXEXEC] {\TeXprefix exec} +\logo [TEXFONT] {\TeXprefix font} +\logo [TEXFORM] {\TeXprefix form} +\logo [TEXGYRE] {\TeX\ Gyre} +\logo [TEXLIVE] {\TeXprefix Live} +\logo [TEXLUA] {\TeXprefix Lua} +\logo [TEXMF] {texmf} +\logo [TEXMFSTART] {texmfstart} +\logo [TEXNL] {tex-nl} +\logo [TEXSHOW] {\TeXprefix show} +\logo [TEXSPELL] {\TeXprefix spell} +\logo [TEXSYNC] {texsync} +\logo [TEXTMATE] {TextMate} +\logo [TEXTOOLS] {\TeXprefix tools} +\logo [TEXUTIL] {\TeXprefix util} +\logo [TEXWORK] {\TeXprefix work} +\logo [TEXWORKS] {\TeXprefix works} +\logo [TEXXET] {\TeX\XeT} \def\XeT{XeT} +\logo [TFM] {tfm} +\logo [THREED] {3D} +\logo [TIF] {tif} +\logo [TIFF] {tiff} +\logo [TIFFINFO] {tiffinfo} +\logo [TIFFTAGS] {tifftags} +\logo [TMFTOOLS] {tmftools} +\logo [TPIC] {tpic} +\logo [TPM] {tpm} +\logo [TRUETYPE] {TrueType} +\logo [TTC] {ttc} +\logo [TTF] {ttf} +\logo [TUG] {tug} +\logo [TUGBOAT] {Tug\-Boat} +\logo [TUGNEWS] {Tug\-News} +\logo [TYPEONE] {Type1} +\logo [TYPETHREE] {Type3} +\logo [UCS] {ucs} +\logo [UNICODE] {Uni\-code} +\logo [UNIX] {Unix} +\logo [URI] {uri} +\logo [URL] {url} +\logo [USA] {usa} +\logo [USB] {usb} +\logo [USENET] {usenet} +\logo [UTF] {utf} +\logo [VAX] {vax} +\logo [VF] {vf} +\logo [VMWARE] {VMWare} +\logo [WDT] {wdt} +\logo [WEB] {web} +\logo [WEBC] {web2c} +\logo [WIKI] {Wiki} +\logo [WINDOWS] {Windows} +%logo [WINNT] {WinNT} +%logo [WINNX] {Win9x} +\logo [WTHREEC] {W3C} +\logo [WWW] {www} +\logo [WIKIPEDIA] {Wikipedia} % WikipediA (looks too weird) +\logo [WYSIWYG] {wysiwyg} +%logo [XDVI] {Xdvi} +\logo [XETEX] {\XeTeX} +\logo [XFDF] {xfdf} +\logo [XHTML] {xhtml} +\logo [XINDY] {Xindy} +\logo [XITS] {Xits} +\logo [XML] {xml} +\logo [XMLTOOLS] {xmltools} +\logo [XPATH] {xpath} +%logo [XPDFETEX] {xpdfe\TeXsuffix} +\logo [XSL] {xsl} +\logo [XSLFO] {xsl-fo} +\logo [XSLT] {xslt} +\logo [XSLTPROC] {xsltproc} +\logo [XYPIC] {XYPIC} % wrong logo +\logo [YandY] {y\&y} +\logo [YOUTUBE] {YouTube} +\logo [ZIP] {zip} +\logo [ZINT] {zint} + +\logo [KB] {KB} +\logo [MB] {MB} +\logo [GB] {GB} +% \logo [TB] {TB} + +\stopmodule diff --git a/tex/context/modules/mkiv/s-obsolete-tokens.mkiv b/tex/context/modules/mkiv/s-obsolete-tokens.mkiv new file mode 100644 index 000000000..117282a60 --- /dev/null +++ b/tex/context/modules/mkiv/s-obsolete-tokens.mkiv @@ -0,0 +1,346 @@ +%D \module +%D [ file=toks-tra, % was toks-ini +%D version=2007.03.03, +%D title=\CONTEXT\ Obsolete Modules, +%D subtitle=Tokens, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D The code here used to be in the \type {toks-tra} files which were made in +%D the real early days of \LUATEX\ and used in articles and presentations +%D about this engine. Because the code is used in manuals we keep it around +%D as module. + +\writestatus{loading}{ConTeXt Obsolete Modules / Tokens} + +%D This used to be in \type {toks-tra.lua}: + +\startluacode + +if not modules then modules = { } end modules ['s-obsolete-tokens'] = { + version = 1.001, + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local utfbyte, utfchar, utfvalues = utf.byte, utf.char, utf.values +local format, gsub = string.format, string.gsub +local tostring = tostring + +local tokens = tokens +local token = token -- the built in one +local tex = tex +local context = context +local commands = commands + +tokens.collectors = tokens.collectors or { } +local collectors = tokens.collectors + +collectors.data = collectors.data or { } +local collectordata = collectors.data + +collectors.registered = collectors.registered or { } +local registered = collectors.registered + +local report = logs.reporter("tokens","collectors") + +-- todo: +-- +-- register : macros that will be expanded (only for demo-ing) +-- flush : print back to tex +-- test : fancy stuff + +local get_next_token = tokens.scanners.next +local create_token = tokens.create + +function collectors.install(tag,end_cs) + local data, d = { }, 0 + collectordata[tag] = data + end_cs = gsub(end_cs,"^\\","") + while true do + local t = get_next_token() + if t.csname == end_cs then + context[end_cs]() + return + else + d = d + 1 + data[d] = t + end + end +end + +local simple = { letter = "letter", other_char = "other" } + +function collectors.show(data) + -- We no longer have methods as we only used (in demos) method a + -- so there is no need to burden the core with this. We have a + -- different table anyway. + if type(data) == "string" then + data = collectordata[data] + end + if not data then + return + end + local ctx_NC = context.NC + local ctx_NR = context.NR + local ctx_bold = context.bold + local ctx_verbatim = context.verbatim + local function show(data) + for i=1,#data do + local tok = data[i] + if type(tok) == "table" then + show(tok) + else + local cmdname = tok.cmdname + local simple = simple[cmdname] + ctx_NC() + ctx_verbatim(simple or cmdname) + ctx_NC() + ctx_verbatim(simple and utfchar(tok.index) or tok.csname) + ctx_NC() + if tok.active then context("active ") end + if tok.expandable then context("expandable ") end + if tok.protected then context("protected ") end + ctx_NC() + ctx_NR() + end + end + end + context.starttabulate { "|Tl|Tc|Tl|" } + ctx_NC() ctx_bold("cmd") + ctx_NC() ctx_bold("meaning") + ctx_NC() ctx_bold("properties") + ctx_NC() ctx_NR() + context.HL() + show(data) + context.stoptabulate() +end + +local function printlist(data) + if data and #data > 0 then + report("not supported (yet): printing back to tex") + end +end + +tokens.printlist = printlist -- will change to another namespace + +function collectors.flush(tag) + printlist(collectordata[tag]) +end + +function collectors.test(tag,handle) + report("not supported (yet): testing") +end + +function collectors.register(name) + report("not supported (yet): registering") +end + +-- -- old token code +-- +-- -- 1 = command, 2 = modifier (char), 3 = controlsequence id +-- +-- local create = token.create +-- local csname_id = token.csname_id +-- local command_id = token.command_id +-- local command_name = token.command_name +-- local get_next = token.get_next +-- local expand = token.expand +-- local csname_name = token.csname_name +-- +-- local function printlist(data) +-- if data and #data > 0 then +-- callbacks.push('token_filter', function () +-- callbacks.pop('token_filter') -- tricky but the nil assignment helps +-- return data +-- end) +-- end +-- end +-- +-- tokens.printlist = printlist -- will change to another namespace +-- +-- function collectors.flush(tag) +-- printlist(collectordata[tag]) +-- end +-- +-- function collectors.register(name) +-- registered[csname_id(name)] = name +-- end +-- +-- local call = command_id("call") +-- local letter = command_id("letter") +-- local other = command_id("other_char") +-- +-- function collectors.install(tag,end_cs) +-- local data, d = { }, 0 +-- collectordata[tag] = data +-- end_cs = gsub(end_cs,"^\\","") +-- local endcs = csname_id(end_cs) +-- while true do +-- local t = get_next() +-- local a, b = t[1], t[3] +-- if b == endcs then +-- context[end_cs]() +-- return +-- elseif a == call and registered[b] then +-- expand() +-- else +-- d = d + 1 +-- data[d] = t +-- end +-- end +-- end +-- +-- function collectors.show(data) +-- -- We no longer have methods as we only used (in demos) method a +-- -- so there is no need to burden the core with this. +-- if type(data) == "string" then +-- data = collectordata[data] +-- end +-- if not data then +-- return +-- end +-- local ctx_NC = context.NC +-- local ctx_NR = context.NR +-- local ctx_bold = context.bold +-- local ctx_verbatim = context.verbatim +-- context.starttabulate { "|T|Tr|cT|Tr|T|" } +-- ctx_NC() ctx_bold("cmd") +-- ctx_NC() ctx_bold("chr") +-- ctx_NC() +-- ctx_NC() ctx_bold("id") +-- ctx_NC() ctx_bold("name") +-- ctx_NC() ctx_NR() +-- context.HL() +-- for i=1,#data do +-- local token = data[i] +-- local cmd = token[1] +-- local chr = token[2] +-- local id = token[3] +-- local name = command_name(token) +-- ctx_NC() +-- ctx_verbatim(name) +-- ctx_NC() +-- if tonumber(chr) >= 0 then +-- ctx_verbatim(chr) +-- end +-- ctx_NC() +-- if cmd == letter or cmd == other then +-- ctx_verbatim(utfchar(chr)) +-- end +-- ctx_NC() +-- if id > 0 then +-- ctx_verbatim(id) +-- end +-- ctx_NC() +-- if id > 0 then +-- ctx_verbatim(csname_name(token) or "") +-- end +-- ctx_NC() ctx_NR() +-- end +-- context.stoptabulate() +-- end +-- +-- function collectors.test(tag,handle) +-- local t, w, tn, wn = { }, { }, 0, 0 +-- handle = handle or collectors.defaultwords +-- local tagdata = collectordata[tag] +-- for k=1,#tagdata do +-- local v = tagdata[k] +-- if v[1] == letter then +-- wn = wn + 1 +-- w[wn] = v[2] +-- else +-- if wn > 0 then +-- handle(t,w) +-- wn = 0 +-- end +-- tn = tn + 1 +-- t[tn] = v +-- end +-- end +-- if wn > 0 then +-- handle(t,w) +-- end +-- collectordata[tag] = t +-- end + +-- Interfacing: + +commands.collecttokens = collectors.install +commands.showtokens = collectors.show +commands.flushtokens = collectors.flush +commands.testtokens = collectors.test +commands.registertoken = collectors.register + +-- Redundant: + +-- function collectors.test(tag) +-- printlist(collectordata[tag]) +-- end + +-- For old times sake: + +collectors.dowithwords = collectors.test + +-- This is only used in old articles ... will move to a module: + +tokens.vbox = create_token("vbox") +tokens.hbox = create_token("hbox") +tokens.vtop = create_token("vtop") +tokens.bgroup = create_token(utfbyte("{"),1) +tokens.egroup = create_token(utfbyte("}"),2) + +tokens.letter = function(chr) return create_token(utfbyte(chr),11) end +tokens.other = function(chr) return create_token(utfbyte(chr),12) end + +tokens.letters = function(str) + local t, n = { }, 0 + for chr in utfvalues(str) do + n = n + 1 + t[n] = create_token(chr, 11) + end + return t +end + +function collectors.defaultwords(t,str) + if t then + local n = #t + n = n + 1 ; t[n] = tokens.bgroup + n = n + 1 ; t[n] = create_token("red") + for i=1,#str do + n = n + 1 ; t[n] = tokens.other('*') + end + n = n + 1 ; t[n] = tokens.egroup + end +end + +\stopluacode + +%D This used to be in \type {toks-tra.mkiv}: + +% used to be: \registerctxluafile{toks-tra}{} + +\unprotect + +%D Handy for manuals \unknown\ but not really used in practice, so it might +%D become a runtime loaded module instead. + +\unexpanded\def\starttokens [#1]{\ctxcommand{collecttokens("#1","stoptokens")}} + \let\stoptokens \relax +\unexpanded\def\flushtokens [#1]{\ctxcommand{flushtokens("#1")}} +\unexpanded\def\showtokens [#1]{\ctxcommand{showtokens("#1")}} +\unexpanded\def\testtokens [#1]{\ctxcommand{testtokens("#1")}} +\unexpanded\def\registertoken #1{\ctxcommand{registertoken("#1")}} + +\let\toks_show\showtokens % we also support the primitive + +\unexpanded\def\showtokens{\doifelsenextoptional\toks_show\normalshowtokens} + +\protect \endinput diff --git a/tex/context/modules/mkiv/s-physics-units.lua b/tex/context/modules/mkiv/s-physics-units.lua new file mode 100644 index 000000000..008320858 --- /dev/null +++ b/tex/context/modules/mkiv/s-physics-units.lua @@ -0,0 +1,86 @@ +if not modules then modules = { } end modules ['s-physics-units'] = { + version = 1.001, + comment = "companion to s-physics-units.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +moduledata.physics = moduledata.physics or { } +moduledata.physics.units = moduledata.physics.units or { } + +local tables = physics.units.tables +local units = tables.units +local shortcuts = tables.shortcuts + +local HL = context.HL +local NC = context.NC +local NR = context.NR + +local function typeset(list,followup,name,category) + if list then + if followup then + context.TB() + end + if category then + HL() + NC() + context.rlap(category .. ":" .. name) + NC() + NC() + NR() + HL() + end + for k, v in table.sortedhash(list) do + NC() + context(k) + NC() + if isunit then + context(v) + else + context.type(v) + end + NC() + if name == "units" or name == "symbols" or name == "packaged" then + context.unittext(v) + elseif name == "prefixes" then + context.prefixtext(v) + elseif name == "operators" then + context.operatortext(v) + elseif name == "suffixes" then + context.suffixtext(v) + end + NC() + NR() + end + if category and name then + HL() + end + end +end + +function moduledata.physics.units.showlist(name) + specification = interfaces.checkedspecification(specification) + context.starttabulate { "|lT|l|c|" } + local name = specification.name + if name and name ~= "" then + local first, second = string.match(name,"(.-):(.-)") -- [units|shortcuts]:[units|...] + if first then + typeset(tables[first] and tables[first][second],false) + else + typeset(units[name],false) + typeset(shortcuts[name],true) + end + else + local done = false + for what, list in table.sortedhash(units) do + typeset(list,done,what,"units") + done = true + end + for what, list in table.sortedhash(shortcuts) do + typeset(list,done,what,"shortcuts") + done = true + end + end + context.stoptabulate() +end diff --git a/tex/context/modules/mkiv/s-version.mkiv b/tex/context/modules/mkiv/s-version.mkiv new file mode 100644 index 000000000..63005aa33 --- /dev/null +++ b/tex/context/modules/mkiv/s-version.mkiv @@ -0,0 +1,123 @@ +%D \module +%D [ file=s-version, +%D version=2011.07.28, +%D title=\CONTEXT\ Version Pictogram, +%D subtitle=Basics, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D This is an oldie that we use to generate a pictogram that reflects the current +%D version. + +\startMPextensions +vardef context_version(expr variant, mark, year, month, day, hours, minutes, seconds) = + + image ( + + interim overloadmode := 0; + + save angle, min, max, mk, yr, mo, da, ho, mi, se, max_mk, max_yr, max_mo, max_da, max_ho, max_mi, max_se ; + + numeric angle, delta ; pair min, max ; angle := 360/7.25 ; delta := (360-7*angle)/7 ; min := (0,10) ; max := (0,100) ; + + numeric mk, max_mk ; max_mk := 8 ; mk := if (mark <= 0) or (mark > max_mk) : max_mk else : mark fi ; + numeric yr, max_yr ; max_yr := 2050 ; yr := if (year <= 2000) or (year > max_yr) : max_yr else : year fi ; + numeric mo, max_mo ; max_mo := 12 ; mo := if (month <= 0) or (month > max_mo) : max_mo else : month fi ; + numeric da, max_da ; max_da := 31 ; da := if (day <= 0) or (day > max_da) : max_da else : day fi ; + numeric ho, max_ho ; max_ho := 24 ; ho := if (hours <= 0) or (hours > max_ho) : max_ho else : hours fi ; + numeric mi, max_mi ; max_mi := 60 ; mi := if (minutes <= 0) or (minutes > max_mi) : max_mi else : minutes fi ; + numeric se, max_se ; max_se := 60 ; se := if (seconds <= 0) or (seconds > max_se) : max_se else : seconds fi ; + + max_da := if (mo = 2) : 28 elseif (mo = 4) or (mo = 6) or (mo = 9) or (mo = 11) : 30 else : 31 fi ; + + if da > max_da : da := max_da fi ; yr := yr - 2000 ; max_yr := max_yr - 2000 ; + + if (variant = 2) or (variant = 3) : + fill fullcircle scaled 205 withcolor .7white ; + fi ; + + color colorant[] ; + + vardef do_context_version(expr i, amount) = + fill (min/2 rotated (-angle/2) -- max { dir -40 } .. max rotated -angle -- cycle) rotated -(i*(angle+delta)) withcolor .3colorant[i] ; + fill (min rotated (-angle/2) -- max { dir -(45+45*amount) } .. max rotated -angle -- cycle) rotated -(i*(angle+delta)) withcolor .7colorant[i] ; + enddef ; + + color orange ; orange := (1,.62,.06) ; % .5white + + colorant[0] := red ; colorant[1] := green ; colorant[2] := blue ; colorant[3] := orange ; + colorant[4] := cyan ; colorant[5] := magenta ; colorant[6] := yellow ; + + do_context_version(0, (yr-1)/max_yr) ; + do_context_version(1, (mo-1)/max_mo) ; + do_context_version(2, (da-1)/max_da) ; + do_context_version(3, (mk-1)/max_mk) ; + do_context_version(4, (ho-1)/max_ho) ; + do_context_version(5, (mi-1)/max_mi) ; + do_context_version(6, (se-1)/max_se) ; + + currentpicture := currentpicture slanted .15 ; + + if (variant = 3) : + setbounds currentpicture to boundingbox currentpicture enlarged 10 ; + addbackground withcolor .3white ; + setbounds currentpicture to boundingbox currentpicture enlarged -5 ; + fi ; + + ) + +enddef ; + +% draw context_version(4,2011,07,28,14,50,30) ; +% draw context_version(4,01,01,01,01,01,01) ; +% draw context_version(4,99,12,31,24,60,60) ; + +\stopMPextensions + +\startluacode + moduledata.versions = moduledata.versions or { } + + function moduledata.versions.drawcontextversion(variant, mark, year, month, day, hours, minutes, seconds) + if not variant then + variant = 3 + end + if not mark then + mark = 4 + year, month, day, hours, minutes, seconds = string.match(environment.version,"(....).(..).(..) (..).(..)") + seconds = 30 + end + context.startMPcode() + context("draw context_version(%s,%s,%s,%s,%s,%s,%s,%s) ;", + variant or 1, + mark or 4, + year or os.date("%y"), + month or os.date("%m"), + day or os.date("%d"), + hours or os.date("%H"), + minutes or os.date("%M"), + seconds or os.date("%S") + ) + context.stopMPcode() + end +\stopluacode + +\continueifinputfile{s-version.mkiv} + +\starttext + +\startluacode + context.startTEXpage() + moduledata.versions.drawcontextversion() + context.stopTEXpage() +\stopluacode + +\stoptext + +% d:\imagemagick\convert.exe -geometry 256x256 s-version.pdf context-version.png +% d:\imagemagick\convert.exe -geometry 72x72 s-version.pdf context-version.ico +% d:\imagemagick\convert.exe -geometry 128x128 s-version.pdf context-version.icns diff --git a/tex/context/modules/mkxl/s-system-tokens.lmt b/tex/context/modules/mkxl/s-system-tokens.lmt new file mode 100644 index 000000000..39258d637 --- /dev/null +++ b/tex/context/modules/mkxl/s-system-tokens.lmt @@ -0,0 +1,247 @@ +if not modules then modules = { } end modules['s-system-tokens'] = { + version = 1.001, + comment = "companion to s-system-tokens.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local context = context +local ctx_NC = context.NC +local ctx_BC = context.BC +local ctx_NR = context.NR +local ctx_FL = context.FL +local ctx_ML = context.ML +local ctx_LL = context.LL +local gsub = string.gsub +local find = string.find +local concat = table.concat + +moduledata.system = moduledata.system or { } +moduledata.system.tokens = moduledata.system.tokens or { } + +local getrange = token.get_range +local getcmdchrcs = token.get_cmdchrcs +local whatever = { [1] = true, [4] = true, [8] = true } + +local collected = nil -- at some point we might have this one preloaded + +function moduledata.system.tokens.collect() + + if not collected then + + local allcommands = tokens.commands + local primitives = tex.primitives() + collected = { } + + for i=0,#allcommands do + local codes = { } + local kind, min, max, fixedvalue = getrange(i) + if min and whatever[kind] and max >= 0 and max <= 256 then + for i=min,max do + codes[i] = false + end + end + collected[i] = codes + collected[allcommands[i]] = codes + end + + for i=1,#primitives do + local prm = primitives[i] + local cmd, chr = getcmdchrcs("normal"..prm) + local codes = collected[cmd] + if codes and codes[chr] == false then + codes[chr] = prm + codes[prm] = chr + else + -- print(cmd,chr) + end + end + + collected.undefined_cs = nil + + -- table.save("whatever.lua",collected) + -- local p = token.getprimitives() + -- table.sort(p,function(a,b) if a[1] == b[1] then return a[2] < b[2] else return a[1] < b[1] end end) + -- table.save("moreever.lua",p) + + -- local p = token.getprimitives() + -- for i=1,#p do + -- local t = p[i] + -- pi[i] = { t[1], t[2], t[3], getrange(t[1]) } + -- end + + -- inspect(collected) + + end + + return collected + +end + +function moduledata.system.tokens.showlist() + + local l = tokens.commands + local t = moduledata.system.tokens.collect() + + context.starttabulate { "|cT|rT|lT|rT|rT|pTA{flushleft,verytolerant,stretch}|" } + ctx_FL() + ctx_BC() context("") + ctx_BC() context("cmd") + ctx_BC() context("name") + ctx_BC() context("min") + ctx_BC() context("max") + ctx_BC() context("default or subcommands") + ctx_BC() ctx_NR() + ctx_ML() + for i=0,#l do + local kind, min, max, fixedvalue = getrange(i) + local what = whatever[kind] + ctx_NC() context(kind) + ctx_NC() context(i) + ctx_NC() context(l[i]) + ctx_NC() if min then if what or min == 0 then context(min) else context("-0x%X",-min) end end + ctx_NC() if max then if what or max == 0 then context(max) else context("0x%X",max) end end + ctx_NC() + if min and what and max >= 0 and max <= 256 then + local l = { } + local c = t[i] + if c then + for j=min, max do + local s = c[j] + if s == " " then + s = "" + elseif not s then + s = "" + end + l[#l+1] = j .. "=" .. s + end + if (#l > 0) then + context(table.concat(l," ")) + elseif fixedvalue ~= 0 then + context("0x%X",fixedvalue) + end + else + print("weird") + end + elseif fixedvalue and fixedvalue ~= 0 then + context("0x%X",fixedvalue) + end + ctx_NC() ctx_NR() + end + ctx_LL() + context.stoptabulate() + +end + +function moduledata.system.tokens.table(t) + local t = t or token.peek_next() -- local t = token.scan_next() token.put_back(t) + local n = "" + local w = "" + local c = t.cmdname + if c == "left_brace" then + w = "given token list" + t = token.scan_toks(false) + elseif c == "register_toks" then + token.scan_next() + w = "token register" + n = t.csname or t.index + t = tex.gettoks(n,true) + elseif c == "internal_toks" then + token.scan_next() + w = "internal token variable" + n = t.csname or t.index + t = tex.gettoks(n,true) + else + n = token.scan_csname() + local r = { } + local m = token.get_meaning(n,true) + if t.frozen then r[#r+1] = "frozen" end + if t.permanent then r[#r+1] = "permanent" end + if t.immutable then r[#r+1] = "immutable" end + if t.primitive then r[#r+1] = "primitive" end + if t.mutable then r[#r+1] = "mutable" end + if t.noaligned then r[#r+1] = "noaligned" end + if t.instance then r[#r+1] = "instance" end + if t.tolerant then r[#r+1] = "tolerant" end + if t.protected then r[#r+1] = "protected" end + r[#r+1] = "control sequence" + if type(m) == "table" then + t = m + else + t = { t } + end + w = concat(r, " ") + end + if type(t) == "table" then + context.starttabulate { "|l|r|r|l|c|l|l|" } + ctx_FL() + ctx_NC() context.formatted.rlap("\\bold %s: %s",w,n) + ctx_NC() ctx_NC() ctx_NC() ctx_NC() ctx_NC() ctx_NC() ctx_NC() + ctx_NC() ctx_NR() + ctx_ML() + for i=1,#t do + local ti = t[i] + local cs = ti.csname + local id = ti.id + local ix = ti.index + local cd = ti.command + local cn = gsub(ti.cmdname,"_"," ") + ctx_NC() context(id) + ctx_NC() context(cd) + ctx_NC() context("%3i",ix) + ctx_NC() context(cn) + if cs then + ctx_NC() + ctx_NC() + ctx_NC() context(cs) + ctx_NC() ctx_NR() + elseif cn == "letter" or cn == "other char" then + ctx_NC() context.char(ix) + ctx_NC() context("%U",ix) + ctx_NC() + ctx_NC() ctx_NR() + elseif cn == "match" then + ctx_NC() + ctx_NC() + if ix == 32 then context("optional spacer") -- space + elseif ix == 43 then context("keep braces") -- "+" + elseif ix == 45 then context("thrash") -- "-" + elseif ix == 61 then context("mandate braces") -- "=" + elseif ix == 94 then context("keep spaces") -- "^" + elseif ix == 95 then context("keep mandate braces") -- "_" + else context("argument %c",ix) + end + ctx_NC() + ctx_NC() ctx_NR() + else + ctx_NC() + ctx_NC() + ctx_NC() + ctx_NC() ctx_NR() + if cn == "end match" then + context.ML() + end + end + end + context.LL() + context.stoptabulate() + else + context.starttabulate { "|l|" } + ctx_FL() + ctx_NC() context("%s: %s",w,n) + ctx_NC() ctx_NR() + ctx_ML() + ctx_NC() context("") + ctx_NC() ctx_NR() + ctx_LL() + context.stoptabulate() + end +end + +interfaces.implement { + name = "luatokentable", + public = true, + protected = true, + actions = moduledata.system.tokens.table, +} diff --git a/tex/context/modules/mkxl/s-system-tokens.mkxl b/tex/context/modules/mkxl/s-system-tokens.mkxl index b83a4f47b..584fcf82f 100644 --- a/tex/context/modules/mkxl/s-system-tokens.mkxl +++ b/tex/context/modules/mkxl/s-system-tokens.mkxl @@ -31,54 +31,11 @@ \starttext - \showsystemtokens - - Some tokens cannot be created yet because they are more complex but eventually the creator will - deal with them. The indices are sometimes the same as internal but in most cases nicely start - at zero. When they start at another value, then there is an internal token or state that is not - user accessible. You always need to use symbolic constants as the numbers can change. - - The first column is a classifier (which is experimental and categories might change when we feel - the need). - - \startcolumns[n=5] - \starttabulate[|T||] - \NC 0 \NC unused \NC \NR - \NC 1 \NC regular \NC \NR - \NC 2 \NC character \NC \NR - \NC 3 \NC register \NC \NR - \NC 4 \NC internal \NC \NR - \NC 5 \NC reference \NC \NR - \NC 6 \NC data \NC \NR - \NC 7 \NC token \NC \NR - \NC 8 \NC node \NC \NR - \stoptabulate - \stopcolumns - - \page - - Here is a typeset table of \type {\startframed} using \type {\luatokentable\startframed}: - \luatokentable\startframed - which calls \type {\pack_framed_start_framed} where \type {\luatokentable\pack_framed_start_framed} gives: - - - \unprotect - \luatokentable\pack_framed_start_framed - \protect - - So you can guess what generates this: - - \unprotect - \luatokentable\pack_framed_start_framed_nop - \protect - - And this: + \page - \unprotect - \luatokentable\pack_framed_start_framed_yes - \protect + \showsystemtokens \stoptext diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index d1462e4b4..3864fbc99 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2021-07-21 19:51 +-- merge date : 2021-07-22 19:11 do -- begin closure to overcome local limits and interference -- cgit v1.2.3