LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-19-2018, 04:51 PM   #1
cristi92b
Member
 
Registered: May 2011
Posts: 91

Rep: Reputation: Disabled
Trying to load scheme library


Hi,

I'm trying to load a scheme library [1] called hlsim in order to follow the tutorial in examples.zip on the same web page.

Code:
cristi@cristi-AX370-Gaming-5 ~/Downloads/examples $ cat Tutorial
;; -*- Scheme -*-
You can use M-z on the following expressions to run the new high level
simulator.

________________________________________________________________________

Load the simulator:

(load-option 'hlsim)

Copy the example files:

The gunk program:
(copy-file "/gunk/hlsim/examples/club5.scm" "club5.scm")

The display utilities:
(copy-file "/gunk/hlsim/examples/club5d.scm" "club5d.scm")

Transform the gunk program:
(cps "club5")

Compile the transformed program:
(cbf "club5")

Compile the display utilities:
(cf "club5d")

Load the display utilities:
(load "club5d")

Make up a simulation:

(define sim (make-sim/1 1000 .05))

Tell the simulation to use a display:
(simulation.display! sim #T)

Load the gunk program:
(simulation.load sim 'init "club5")

Run the simulation:
(simulation.run sim)

Gather some statistics
(simulation.eval sim 'collisions)
(simulation.eval sim '(length clubs-i-belong-to))
There are two other zip files on this page:

linux.zip - Contains 32-bit binaries and libraries to execute scheme.
Code:
cristi@cristi-AX370-Gaming-5 ~/Downloads/linux/bin $ file *
bchscheme:     ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.1, not stripped
edwin:         POSIX shell script, ASCII text executable
scheme:        ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.1, not stripped
update-scheme: Bourne-Again shell script, ASCII text executable
I'm currently using 64-bit Linux Mint 18.3 so I cannot use them therefore, I installed the mit-scheme package with the package manager.

hlsim.zip - This contains the scheme library/package I'm trying to use.

[1] https://groups.csail.mit.edu/mac/pro...s/6.966/hlsim/

==============

I created the /gunk/hlsim/stable folder and extracted the hlsim.zip content according to hlsim instalaltion steps provided.
Then I added the lines that are supposed to load the library in ~/.scheme.init
Code:
cristi@cristi-AX370-Gaming-5 /gunk/hlsim/stable/STABLE $ cat ~/.scheme.init 
	(define-load-option 'hlsim
		(lambda ()
			(load "/gunk/hlsim/stable/loader")))
The only problem is, when I open scheme and I try to load hlsim, I get this "file missing" error:
Code:
cristi@cristi-AX370-Gaming-5 ~/Downloads $ scheme
MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.

Copyright (C) 2011 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Image saved on Sunday February 7, 2016 at 10:35:34 AM
  Release 9.1.1     || Microcode 15.3 || Runtime 15.7 || SF 4.41
  LIAR/x86-64 4.118 || Edwin 3.116
;Loading "/home/cristi/.scheme.init"... done

1 ]=> (load-option 'hlsim)

;Loading "/gunk/hlsim/stable/loader.scm"...
;Unable to find file "sim" because: File does not exist.
;To continue, call RESTART with an option number:
; (RESTART 1) => Return to read-eval-print level 1.

2 error>
The folder structure looks like this:

Code:
cristi@cristi-AX370-Gaming-5 /gunk/hlsim/stable $ ls -la
total 636
drwxr-xr-x 3 root root   4096 Feb 18 17:50 .
drwxr-xr-x 4 root root   4096 Feb 18 17:42 ..
-rw-rw-r-- 1 root root   7200 Sep 25  1997 agenda-skip.bci
-rw-rw-r-- 1 root root   3952 Sep 25  1997 agenda-skip.com
-rw-rw-r-- 1 root root   1720 Jul 22  1997 agenda-skip.ext
-rw-rw-r-- 1 root root   4943 Sep  8  1997 comms1.bci
-rw-rw-r-- 1 root root   3812 Sep  8  1997 comms1.com
-rw-rw-r-- 1 root root   5847 Sep 25  1997 comms3.bci
-rw-rw-r-- 1 root root   4444 Sep 25  1997 comms3.com
-rw-rw-r-- 1 root root  52090 Sep  8  1997 cps3.bci
-rw-rw-r-- 1 root root  31536 Sep  8  1997 cps3.com
-rw-rw-r-- 1 root root   8745 Sep 25  1997 cps3-runtime.bci
-rw-rw-r-- 1 root root   5780 Sep 25  1997 cps3-runtime.com
-rw-rw-r-- 1 root root   8667 Sep 25  1997 devices.bci
-rw-rw-r-- 1 root root   5828 Sep 25  1997 devices.com
-rw-rw-r-- 1 root root   2696 Sep 25  1997 devices.ext
-rw-rw-r-- 1 root root  12905 Sep 25  1997 init.bci
-rw-rw-r-- 1 root root   7656 Sep 25  1997 init.com
-r--r--r-- 1 root root    362 Sep 18  1997 loader.scm
-rw-rw-r-- 1 root root   7894 Sep  8  1997 macros.bci
-rw-rw-r-- 1 root root   5940 Sep  8  1997 macros.com
-rw-rw-r-- 1 root root  38025 Sep 25  1997 neighbours.bci
-rw-rw-r-- 1 root root  24224 Sep 25  1997 neighbours.com
-rw-rw-r-- 1 root root  42353 Sep 25  1997 pnm.bci
-rw-rw-r-- 1 root root  25916 Sep 25  1997 pnm.com
-rw-rw-r-- 1 root root   9180 Sep 25  1997 pnm.ext
-rw-rw-r-- 1 root root 105343 Sep 25  1997 sim.bci
-rw-rw-r-- 1 root root  70160 Sep 25  1997 sim.com
-rw-rw-r-- 1 root root  49356 Sep 25  1997 sim.ext
-rw-rw-r-- 1 root root   5359 Sep  8  1997 simrun0.bci
-rw-rw-r-- 1 root root   3360 Sep  8  1997 simrun0.com
-rw-rw-r-- 1 root root   8551 Sep  8  1997 simrun2.bci
-rw-rw-r-- 1 root root   4268 Sep  8  1997 simrun2.com
drwxr-xr-x 3 root root   4096 Feb 18 15:51 STABLE
Code:
cristi@cristi-AX370-Gaming-5 /gunk/hlsim/stable/STABLE $ ls -la
total 12
drwxr-xr-x 3 root root 4096 Feb 18 15:51 .
drwxr-xr-x 3 root root 4096 Feb 18 17:50 ..
drwxr-xr-x 2 root root 4096 Sep 25  1997 SRC-SNAPSHOT
Code:
cristi@cristi-AX370-Gaming-5 /gunk/hlsim/stable/STABLE/SRC-SNAPSHOT $ ls -la
total 176
drwxr-xr-x 2 root root  4096 Sep 25  1997 .
drwxr-xr-x 3 root root  4096 Feb 18 15:51 ..
-r--r--r-- 1 root root  3844 Jun 21  1997 agenda-skip.scm
-r--r--r-- 1 root root  1746 Aug 16  1996 comms1.scm
-r--r--r-- 1 root root  4963 Sep 25  1997 comms3.scm
-r--r--r-- 1 root root  7765 Aug 25  1997 cps3-runtime.scm
-r--r--r-- 1 root root 18074 Sep  3  1997 cps3.scm
-r--r--r-- 1 root root 20250 Jun 20  1997 cps4.scm
-r--r--r-- 1 root root  4175 Sep 23  1997 devices.scm
-r--r--r-- 1 root root   275 Sep  8  1997 hlsim.cbf
-r--r--r-- 1 root root   372 Sep 18  1997 hlsim.sf
-r--r--r-- 1 root root  8074 Sep 25  1997 init.scm
-r--r--r-- 1 root root   362 Sep 18  1997 loader.scm
-r--r--r-- 1 root root  2312 Jun 17  1997 macros.scm
-r--r--r-- 1 root root 12426 Sep 22  1997 neighbours.scm
-r--r--r-- 1 root root 14095 Sep 21  1997 pnm.scm
-r--r--r-- 1 root root  1344 Aug 14  1996 simrun0.scm
-r--r--r-- 1 root root  2229 Jun 21  1997 simrun2.scm
-r--r--r-- 1 root root 32631 Sep 25  1997 sim.scm
Could you please point me in the right direction?
There are 3 files called sim.bci, sim.com and sim.ext in /gunk/hlsim/stable but I'm not sure why it cannot find them. Maybe it tries loading a file called sim.scm?
I'm not sure because I never used scheme before.

Kind regards,

Cristian
 
Old 02-25-2018, 04:53 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,838
Blog Entries: 6

Rep: Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667Reputation: 2667
I have seen this lonely post for several days, hoping that someone with relevant knowledge would drop by. But, alas...

I had some exposure to lisp and scheme very, very long ago, but about all that sticks with me is the spelling of the words "lisp" and "scheme". I have looked around online for a place to start, or something to spark my own memory, but have not had time or attention span available to produce a useful result.

The best documentation resource I found was the complete book online, The Scheme Programming Language, along with other resources and archives available through links in the home page of that site. Links to many resources including a scheme users site can be found through the Resources link on that page as well. Lots of stuff, perhaps what you need is there!

Sorry I cannot be more help, good luck!
 
1 members found this post helpful.
Old 02-25-2018, 05:37 PM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,388

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by cristi92b View Post
There are 3 files called sim.bci, sim.com and sim.ext in /gunk/hlsim/stable but I'm not sure why it cannot find them. Maybe it tries loading a file called sim.scm?
I'm not sure because I never used scheme before.
https://www.gnu.org/software/mit-sch...ing-Files.html says
Quote:
By convention, files of source code have a pathname type of "scm", and files of binary SCode have pathname type "bin". Native-code binaries have pathname type "com".
So I guess it's supposed to be loading sim.com. I tried installing mit-scheme and doing (load ".../sim.com") directly, but I got

Code:
;Loading "../sim.com"...
;Illegal character: #\U+06
Maybe the the binary files are not portable? Or perhaps they're just from an old version?
 
2 members found this post helpful.
Old 03-01-2018, 03:48 PM   #4
cristi92b
Member
 
Registered: May 2011
Posts: 91

Original Poster
Rep: Reputation: Disabled
Thank you very much for your answers! I will let you know if I find something.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Error 2 on load library Brandt087 Linux - Software 17 04-13-2015 07:46 AM
Can't load shared library (but it's right there!) brazzle Programming 8 02-17-2011 12:12 AM
Library load path ernst Linux - Software 7 08-31-2008 06:03 AM
Password generation failed for scheme {CRYPT}: scheme not recognized olva Linux - General 0 11-05-2006 12:21 PM
How do you load dynamically a library from C? Hano Programming 4 06-07-2002 04:04 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration