12/27/2023 0 Comments Free42 forum![]() The content of that subroutine can be provided by calling the a user provided function via the gen-target-code argument. When a local label is generated, the subroutine for that label will also be generated. When gen-target-label is nil, then the menu target column is used unless it is empty, and then the menu key is used. In general this might be summarized as follows: When gen-target-label is non-nil, the target is determined by the gen-target-label function. Note the returned string must contain embedded quotes if it is a global label target. If the return is nil, then the label is auto-generated. ![]() Now that we know how the menu key strings are constructed, what about the GTO/XEQ target for the generated KEY commands? The following rules are applied with the first one matching being used: gen-target-label target-column Menu Key Menu Target The XEQ/GTO Target nil nil "LBL NN" N/A Auto-generated nil nil N/A N/A Menu key string nil non-nil "LBL NN" "" (empty) Auto-generated nil non-nil N/A "" (empty) Menu key string nil non-nil N/A "LBL NN" NN nil non-nil N/A N/A Menu target non-nil N/A N/A N/A See next table When gen-target-label is non-nil, the return value of the function determines the target. If the key string is "" (empty) or "óóóó", then a blank key will be placed in the menu. In this way one can dynamically decide if a menu key should be active or not. If this subroutine returns RETNO then the menu key s KEY command will be skipped. This allows the key s alpha string to be dynamically generated by a subroutine at run time. In this case the local label will be XEQ ed just before the call to KEY. That exception occurs when the final component looks like "LBL NN" where NN is a two digit number (table line 2). The final component, foobar in this example, is used for the alpha string for the menu key. ![]() The string foo:bar:foobar (table line 1) defines a top level button named foo that leads to a menu containing another menu named bar which contains an action key named foobar. Line Menu alpha strings Menu targets Some Data Some More Data 1 foo:bar:foobar marry red 2 foo:bar:lbl 77 LBL 87 had a blue 3 foo:bar:lbl 78 fooboo little yellow 4 foo:bar:lbl 78 lamb green One column of the table is used to define the menu alpha strings. The only limitation on menu depth and size are the number of available two digit labels. Contents 1 Metadata 1 2 Introduction 2 3 Generating 42s menu code Generic menu generator For CUSTOM-type Menus Always generate local lables Emacs Helper Stuff Emacs function to insert charcters given a list of character codes Emacs Mode for 42s Code yas templates Export & Tangle from dired Prepare Code For Conversion 9 6 Prepare Marked Region for Code Conversion 10 7 Tangle & Load Tangled File 10 8 free42 Notes Character Set Date format Stats registers DM 42 Notes Display EOF 14 1 Metadata The home for this HTML file is: A PDF version of this file may be found here: Files related to this document may be found on github: Directory contents: 1Ģ src - The org-mode file that generated this HTML document src_42s - Ready to convert source listings for 42s code in this document docs - This html document and associated PDF bin - Importable RAW program files 2 Introduction This org-mode document contains various tools (mostly for Emacs) that help me write programs for the 42s: Elisp function to generate 42s menu programs A tool to insert free42 utf-8 characters given a list of character numbers Elisp function to generate custom menus (menus of built-in functions and global labels) yasnippet templates to help type code ElISP Code to translate my code listings into code for free42 & MD42 42s notes free42 utf-8 characters with character numbers 3 Generating 42s menu code 3.1 Generic menu generator This code will read an org-mode table describing a menu, and generate 42s code to implement the menu. 1 free42 Programming Tools Mitch Richling Author: Mitch Richling Updated: :30:23 Copyright 2021 Mitch Richling.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |