{"id":15638075,"url":"https://github.com/superilu/jsh","last_synced_at":"2025-04-06T01:10:48.090Z","repository":{"id":101411269,"uuid":"189727674","full_name":"SuperIlu/jSH","owner":"SuperIlu","description":"A Javascript scripting engine for DOS","archived":false,"fork":false,"pushed_at":"2024-12-20T17:50:41.000Z","size":37249,"stargazers_count":114,"open_issues_count":1,"forks_count":4,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-03-30T00:09:44.883Z","etag":null,"topics":["dos","freedos","javascript","ms-dos","msdos","retro","retrocomputing"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SuperIlu.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-01T11:59:41.000Z","updated_at":"2024-12-28T16:48:38.000Z","dependencies_parsed_at":"2025-01-07T22:18:30.935Z","dependency_job_id":null,"html_url":"https://github.com/SuperIlu/jSH","commit_stats":{"total_commits":18,"total_committers":3,"mean_commits":6.0,"dds":"0.38888888888888884","last_synced_commit":"d030ca71ffe9343ee72aa3573adf1701ab6518fa"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperIlu%2FjSH","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperIlu%2FjSH/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperIlu%2FjSH/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SuperIlu%2FjSH/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SuperIlu","download_url":"https://codeload.github.com/SuperIlu/jSH/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419861,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dos","freedos","javascript","ms-dos","msdos","retro","retrocomputing"],"created_at":"2024-10-03T11:17:45.575Z","updated_at":"2025-04-06T01:10:48.069Z","avatar_url":"https://github.com/SuperIlu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jSH\n![jSH logo](doc/jSH.png)\n## A Javascript scripting engine for DOS\n[jSH](https://github.com/SuperIlu/jSH) is a script interpreter for DOS based operating systems like MS-DOS, [FreeDOS](http://freedos.org/) or any DOS based Windows (like 95, 98, ME). The focus is on file io and text mode user interfaces.\n\n**jSH is a small side project to [DOjS](https://github.com/SuperIlu/DOjS), a Javascript coding environment for MS-DOS  supporting graphics, sound, etc. including a built in editor and much more**\n\nThe following script e.g. renames all file extensions in a given directory:\n```Javascript\nif (args.length \u003c 3) {\n\tPrintln(\"Usage:\");\n\tPrintln(\"   jSH.exe renall.js \u003cdir\u003e \u003cold ext\u003e \u003cnew ext\u003e\");\n\tExit(1);\n}\n\nvar dir = args[0];\nvar oldExt = args[1].toUpperCase();\nvar newExt = args[2].toUpperCase();\n\nvar files = List(dir);\nfor (var i = 0; i \u003c files.length; i++) {\n\tvar oldName = files[i].toUpperCase();\n\tif (oldName.lastIndexOf(oldExt) != -1) {\n\t\tvar baseName = oldName.substring(0, oldName.lastIndexOf(oldExt));\n\t\tvar newName = baseName + newExt;\n\t\tPrintln(dir + \"\\\\\" + oldName + \" =\u003e \" + dir + \"\\\\\" + newName);\n\t\tRename(dir + \"\\\\\" + oldName, dir + \"\\\\\" + newName);\n\t}\n}\nPrintln(\"All done...\");\n```\nAnd can be run like this: `JSH.EXE RENALL.JS SOMEDIR .FOO .BAR` to rename all files ending in `.FOO` to `.BAR`.\n\njSH was only possible due to the work of these people/projects:\n* [MuJS](https://mujs.com/) JavaScript interpreter\n* [DJGPP](http://www.delorie.com/djgpp/) from DJ Delorie and the [Linux compile scripts](https://github.com/andrewwutw/build-djgpp) by Andrew Wu.\n\nYou can find me on [Twitter](https://twitter.com/dec_hl) if you want...\n\n# Download and quick start\n**You can find binary releases on the [GitHub release page](https://github.com/SuperIlu/jSH/releases). Just extract the contents of the archive and run jSH.**\n\njSH runs in [Dosbox](https://www.dosbox.com/) and on real hardware or a virtual machine with MS-DOS, [FreeDOS](https://www.freedos.org/) or any DOS based Windows like Windows 95/98/ME.\n\nIf you run it on real hardware you need at least a **80386 with 4MB**. I recommend a **Pentium class machine with at least 8MB RAM**.\n\nThe API is documented in the [doc/html/](http://htmlpreview.github.io/?https://github.com/SuperIlu/jSH/blob/master/doc/html/index.html) directory.\n\nFor now jSH comes only with a single bigger example: *JsCommander*. A minimal file manager in the style of the well known Norton Commander.\n![jc screenshot](doc/JsCommander.png)\n\n## additional packages\njSH has a very simple integrated package manager (JPM). It can be started with `JPM.BAT`.\nA working packet driver is needed to connect to the package index and download packages using HTTPS.\nPackages (and the package index) are fetched from the [DOjS/jSH package repository](https://github.com/SuperIlu/DOjSHPackages).\nDownloaded packages are put into `JSBOOT.ZIP` in the `PACKAGE/` directory.\nFeel free to submit any packages you want to include in that repository using a pull request.\nDPM commands:\n  * installed - list installed packages.\n  * remove    - remove package.\n  * fetch     - fetch package index from server.\n  * install   - install a package (and its dependencies) from package index.\n  * list      - list available packages in index.\n  * setindex  - set index URL (HTTP or HTTPS).\n  * help      - this help.;\n  * quit      - exit dpm.\n\n# Compilation\nYou can compile jSH on any modern Linux (the instructions below are for Debian based distributions) or on Windows 10 using Windows Subsystem for Linux (WSL).\nSetup Windows Subsystem for Linux (WSL) according to [this](https://docs.microsoft.com/en-us/windows/wsl/install-win10) guide (I used Ubuntu 18.04 LTS).\n\n## Preparation\nBuild and install DJGPP 7.2.0 according to [this](https://github.com/andrewwutw/build-djgpp) guide.\nI used the following command lines to update/install my dependencies:\n```bash\nsudo apt-get update\nsudo apt-get dist-upgrade\nsudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev g++ unzip htop screen git bash-completion build-essential npm python-yaml zip dos2unix python3\nsudo npm install -g jsdoc\nsudo npm install -g better-docs\n```\n\nAnd the following commands to build and install DJGPP to `/home/ilu/djgpp`.:\n```bash\ngit clone https://github.com/andrewwutw/build-djgpp.git\ncd build-djgpp\nexport DJGPP_PREFIX=/home/ilu/djgpp\n./build-djgpp.sh 7.2.0\n```\n\nMake sure `dxe3gen` and `dxe3res` are installed as well and set `DJPATH` permanently to your installation directory of DJGPP.\n\n## Getting \u0026 Compiling jSH\nOpen a shell/command line in the directory where you want the source to reside.\n\nCheckout jSH from Github:\n```bash\ngit clone https://github.com/SuperIlu/jSH.git\n```\n\nOpen the Makefile in a text editor and change the path to DJGPP according to your installation.\n\nNow you are ready to compile jSH with `make clean all`. This might take some time as the dependencies are quite a large.\n`make distclean` will clean dependencies as well. `make zip` will create the distribution ZIP and `make doc` will re-create the HTML help.\n\n## Creating native libraries (DXEs)\nHave a look at the example libraries in `test.dxelib/` and `test2.dxelib/`. Some rules:\n* A library called `foo` must have the filename `foo.dxe` and must provide at least the function `void init_foo(js_State *J)`. This function is called when the library is loaded and can then register global variables/objects/classes/function in the Javascript runtime.\n* The library may also provide the function `void shutdown_foo(void)` (this is completely optional). This will get called during shutdown and can perform cleanup.\n* All libraries in the sourcetree will be build by the `make all` target if their dir-name ends with `.dxelib`. The Makefile in the directory must provide the targets all, clean and distclean (see examples).\n* Libraries should use the `Makefile.dxemk` whenever possible.\n* In theory it should be possible to compile additional native libraries without re-compiling `jSH.EXE` if the same compiler is used (see above). \n* Native libraries may use all functions from `mujs.h` and all functions in `dxetemplate.txt`. If additional functions are needed these need to be included in the template and `jSH.EXE` must be recompiled!\n* When libraries are compiled the exports provided by jSH are checked against the used functions (see `check_exports.py`) and the build fails if there are symbols missing.\n* Feel free to provide your native libraries and/or changes to `dxetemplate.txt` for inclusion in the jSH GitHub repository (MIT license please)...\n\n# History\nSee the [changelog](/CHANGELOG.md) for the projects history.\n\n# Licenses\n## jSH\nAll code from me is released under **MIT license**.\n\n## MuJS\nMuJS is released under **ISC license**. See *COPYING* in the MuJS folder for details.\n\n## DZComm\nDZComm serial library is release as **gift-ware**. See *readme.txt* in the dzcomm folder for details.\n\n## CWSDPMI.EXE\n[CWSDPMI](http://sandmann.dotster.com/cwsdpmi/) DPMI host is licensed under **GPL**. The documentation states:\n\u003e The files in this binary distribution may be redistributed under the GPL (with source) or without the source code provided.\n\n## zip code\n[zip](https://github.com/kuba--/zip) is licensed by UNLICENSE\n\n## WATTCP\nWATTCP - TCP/IP library routines\n\nCopyright (c) 1990, 1991, 1992, 1993 Erick Engelke\n\nPortions Copyright (c) 1993  Quentin Smart\nPortions Copyright (c) 1991  University of Waterloo\nPortions Copyright (c) 1990  National Center for Supercomputer Applications\nPortions Copyright (c) 1990  Clarkson University\nPortions Copyright (c) 1983, 1986, Imagen Corporation\n\n    This software is distributed in the hope that it will be useful,\n    but without any warranty; without even the implied warranty of\n    merchantability or fitness for a particular purpose.\n\n**RESTRICTIONS**\nYou may freely use this library to produce programs which you may give\naway or sell in source format, or as compiled executables, or both.\n\nYou may not sell this library or a portion thereof or distribute modified\nversions the library code in either source or OBJect or LIBrary format\nwithout written permission from the author.  The author still maintains\ncopyright privileges and will assert the privileges of ownership for\npurposes of royalties such distributions.\n\nPortions of this code were written or enhanced by others and offerred\nto me for distribution in WATTCP under my copyright.  To my knowledge,\nall copyrights exercised are listed at the top of this file.  If this\nis incorrect, please contact me so I can rectify the situation.\n\n## PCTIMER\n[PCTIMER](http://technology.chtsai.org/pctimer/) is Freeware\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperilu%2Fjsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuperilu%2Fjsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuperilu%2Fjsh/lists"}