Short: Embed C source in a Python script DEMO Author: wisecracker.bazza@gmail.com (Barry Walker, G0LCU) Uploader: LAG (Lincolnshire Amiga Group) Type: dev/gcc Version: 1.00.00 Architecture: generic Distribution: Public Domain, Emailware. ============================================================================ Architectures: Classic AMIGAs, WinUAE, FS-UAE, OSX 10.14.3, Linux Mint 19. -------------------------------------------------------------------------- MINIMUM Requirements Are:- -------------------------- Stock A1200, 4MB Fastram and HDD. WinUAE 3.4.0, minimum. FS-UAE 2.8.1, minimum. Standard OS 3.0.x install or better. Full Python 1.4.0, minimum, installed, (full install on AMINET): https://aminet.net/package/dev/lang/Python_14 Full ADE UNIX environment install, (full install on AMINET): https://aminet.net/package/dev/gcc/ADE Library file ixnet.library version 48.0 Library file ixemul.library version 48.0 Both files are here if you have NOT got them: https://aminet.net/package/util/libs/ixemul-48.0 (OSX 10.14.3, gcc 4.2.1 and Python 2.7.10, 3.5.2; and also Linux Mint, gcc 7.3.0 and Python 2.7.10.) ---------------------------------------------------------------------------- History:- --------- 01-05-2019. ----------- Version 1.00.00. Probably the one and only upload for this archive. ---------------------------------------------------------------------------- General:- --------- (Apologies for any typos, etc...) Consider this README the instruction manual too. 'C_Source_In_Python.py.txt' This is a Python DEMO designed to run under ADE the *NIX style emulator to create a C script to be compiled under gcc 2.95.3 for the AMIGA A1200. It requires all the dependencies above as it is aimed at AMIGA users of a *NIX style operating system. The C source will build a simple calculator as ADE does not have one by default. It can do floating point, add, subtract, multiply, divide, power and nthroot. As it stands it can be used stand alone in *NIX mode and can cater for floating point arithmetic for KSH88 the default shell for ADE. This python script is designed to demonstrate how to embed a C source[1] into a python script to build your own gcc compiled executables as part of the ADE /bin/ package. The two new files generated are saved inside the current drawer and called mycalc.c, the C source, and calc, the executable file. 1) Download Python_14, unpack and install to the DRIVE:Drawer of your choice. 2) Assign a PYTHON: volume to the DRIVE:Drawer of your Python drawer. For example: Assign PYTHON: WORK:Python-1.4 3) Download ADE, unpack and install ADE the UNIX environment to the DRIVE/Drawer of your choice. 4) As per the instructions install ixnet.library and ixemul.library to the Libs drawer, ONLY, if you have NOT got them. 5) Once everything is ready download the C_Source_In_Python.py.txt and rename it to "C_Source_In_Python.py" without the quotes. 6) Start an AMIGA shell and open it up to at least full width and height. Everything will be inside the AMIGA shell now. 7) Copy the above file from where it was downloaded to your VOLUME:ADE/home drawer. 8) Copy the Python executable to ADE:bin/ drawer as python. 9) Optionally; do the same for MEmacs as this will give a useful editor too in case you need a reasonable one for any editing. 10) Go to YOUR ADE drawer and "Execute ADE-Satrtup" without the quotes. 11) Now enter KSH88 as ksh and after a short while you will then see a prompt, something like: /WORK/ADE> 12) Change this drawer to: cd home 13) Your prompt should now look something like: /WORK/ADE/home> 14) You can now run the file as: python C_Source_In_Python.py Where is the ENTER key. 15) The program is SSLLOOWW so be patient. A few notes to be very, VERY aware of:- --------------------------------------- [1] ALL C sources INSIDE any Python code MUST have any _single_ escaped characters in them with _double_escaped characters; for example: 'n' becomes '\n' without the quotes. This will ensure that the correct script will be generated. [2] Remember this is designed for a stock A1200, so it is not quick at compiling. We are not dealing with multi-core, mega-memory, hyper-speed CPUs and modern coding algorithms here so be patient. [3] Not only does this code create a basic calculator for ADE but shows how to get the calculated result into a python _variable_ too. [4] This code will run inside Python 2.0.1 too but requires much improved AMIGA HW to run python 2.0.x. Untested inside Python 2.4.6 on AMINET but might work there also. [5] And finally read the DEMO script for more information. Enjoy... Bazza... ---------------------------------------------------------------------------- Lincolnshire Amiga Group: https://lincsamiga.org.uk/wordpress/ ---------------------------------------------------------------------------- This archive is issued under the CC0 Licence. Public Domain. ---------------------------------------------------------------------------- IMPORTANT:- ----------- The Legal Stuff:- ----------------- This code is CC0 licenced. The author is not responsible for any damage to, or loss of, or failure of equipment or data caused in any way by the use of this code. There is NO warranty with the use of this software release and YOU USE IT AT YOUR OWN RISK. ---------------------------------------------------------------------------- Testing Evaluation:- -------------------- All WinUAE, FS-UAE and Classic AMIGA test conditions were/are running standard OS 3.0.x and using standard ~topaz 8~ fonts throughout. The minimum hardware and software requirements ARE needed however. I have no idea what strange configuration setups will create so refer to the ~The Legal Stuff~ above. ---------------------------------------------------------------------------- Barry Walker, G0LCU. ---------------------------------------------------------------------------- A very useful HardWare related site, (C) Anthony Hoffman, for modifications, schematics, repairs and the like is:- http://amiga.serveftp.net/ ============================================================================