View on GitHub

yabasiclibs

extension libraries for yabasic

linuxmisclib.yab

A yabasic library (c) Michel Clasquin-Johnson 2018. Licensed according to the MIT license.

If you are reading this as a man page, be advised that you can see it in glorious HTML, with pictures even, at https://clasqm.github.io/

This library for yabasic allows the use of a variety of common Linux commands in text mode. For example, opening a text file in the nano text editor will make it unnecessary for you to write your own text editing routine.

This library also contains some routines ported from my libraries originally developed under yab for Haiku.

These routines make heavy use of system() and system$() commands, and some write temporary files, work on them, and read them back. They. will. slow. your. programs. down. a. lot. Also, ensuring that you (or your users) have the appropriate packages installed will be up to you. The routines themselves only check for the existence of the binary and exit with an error message if it is not found. All I can tell you is that every utility used here was found in the Debian/Ubuntu repositories. apt-cache search is your friend.

All routines are case-sensitive.

Developed on elementary OS 0.4 “Loki” and Lubuntu 18.04 (i.e. Linux), but it should work on any system that will run both yabasic and the command in question.

The yabasic I use for development is version 2.78.5, compiled and installed from source obtained at www.yabasic.de.

The library should exist either in the same folder as your program (symlinks work, but if you have trouble with binding, just copy the library, it is not THAT big!) or in the standard yabasic library location on your system.

To use the library, use the command

import linuxmisclib

before you start using any of the routines.

See the file test.bas for test routines that will show examples of how to use these routines.

If you would rather cut and paste these subroutines into your own program rather than importing this rather large library, or create your own, smaller library with just the routines you need, be my guest (I would appreciate a note of acknowledgement in your code). But some subroutines require supporting routines that you will find at the end of this library. You will have to include those as well.

It is safe to use this library and ONE of the others in this set that provide dialogs concurrently,


Routines available:

NOTE: All routines with the form ConvertXXX$(), OpenXXX$() or OpeninXXX$(), and most others that use external commands, will return an empty string if successful or a warning message if the required program is missing. The warning message will only be displayed if you do something like:

print OpeninTpp$("file.tpp")

(assuming tpp is not installed). Or you can test for its presence like this:

if OpeninTpp$("file.tpp") <> "" {do something}


Original image

print MakeAsciiArt$("./imgs/MCJ.jpg", 40)

MakeAsciiArt

print reverse MakeAsciiArtInvert$("./imgs/MCJ.jpg", 40)

MakeAsciiArtInvert

NotifyDlg

TakeScreenshot


Appendix 1: Pandoc formats

Input formats: commonmark, docbook, docx, epub, haddock, html, json*, latex, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, odt, opml, org, rst, t2t, textile, twiki

Output formats: asciidoc, beamer, commonmark, context, docbook, docx, dokuwiki, dzslides, epub, epub3, fb2, haddock, html, html5, icml, latex, man, markdown, markdown_github, markdown_mmd, markdown_phpextra, markdown_strict, mediawiki, native, odt, opendocument, opml, org, plain, revealjs, rst, rtf, s5, slideous, slidy, texinfo, textile

pandoc formats

Appendix 2: Language support for wikipedia2text

Code Language Code Language
af Afrikaans la Latin
als Alemannic lb Luxembourgian
ca Catalan nds Low German
cs Czech nl Dutch
da Danish nn Norwegian (Nynorsk
de German no Norwegian (Bokmål)
en English pl Polish
eo Esperanto pt Portuguese
es Spanish rm Rhaeto-Romanic
fi Finnish ro Romanian
fr French simple Simple English
hu Hungarian sk Slovak
ia Interlingua sl Slovenian
is Islandic sv Swedish
it Italian tr Turkish