Where to find the .SCM files

Geert Janssens geert.gnucash at kobaltwit.be
Wed Feb 25 09:22:54 EST 2015


[ I'm answering this on the gnucash-devel list. I don't think most users are interested in this 
technical essay. ]

On Wednesday 25 February 2015 03:37:36 David wrote:
> Thanks Jim for the warning, I had read the link above and went to this
> link given in that page to start learning Scheme.
> http://www.scheme.com/tspl2d/start.html#g1546
> 
> But that book must be for real programmers not novices like myself.  I
> got some of the exercises done but then ran into a brick wall when he
> said to write a file and then invoke it.
> 
A guile script is in essence a plain text file written in the guile language. So you could use any 
plain text editor to write one. It helps a lot if your text editor understands the guile language so 
it can colorize your script. This is called syntax highlighting and makes it much easier to read 
back what you wrote or what others have written (like the reports).

Example plain text editors on linux are gedit, kwrite or kate. Instead of a basic text editor you 
can also go for fully fledged IDE's such as KDevelop, Anjuta or Eclipse. The latter are more 
similar of visual studio on Windows with all kinds of development aids.

Whatever you choose, you best choose an editor that does syntax highlighting for guile/scheme. 
I know kate and kwrite do, and that Eclipse doesn't.

As for the file system, the biggest difference between linux and Windows is that linux doesn't 
use drive letters. Extremely simplified (just to get you started), you could think there is only one 
drive in linux.
To access it your file paths have to start with "/". On windows to access your main drive your 
paths usually start with "c:\".

Directories in a path are separated by a "/", where Windows uses a "\".

So where should you store your test scripts ? Simply put: wherever you like. Guile doesn't put 
any restrictions on this. This is of course different once you are editing a report for gnucash. As 
Plutocrat pointed out, these should go in the .gnucash directory.

So more in general, where do you store files in linux ?
Just like modern Windows versions, linux has always kept user data in dedicated directories per 
user. Each user of the system will have its dedicated home directory under, well, "/home/". For 
example if your user name is "david" then your personal home directory will be "/home/david/". 
In some save dialogs this is also called your "Personal Directory" or simply "Home", or "david".

On Windows it would have been "c:\Users\david"

Lastly: about "invoking" the script. This you have to do from the command line, alias terminal or 
even console.

I suppose you know how to open one if you have been playing with guile examples already.

So to invoke a guile script you have written, you append it to the guile command like this:
guile /path/to/my/guile/script

In this case guile will run your script instead of starting with a prompt asking for guile code to 
input.

There is much more to say about this, but I hope this gets you started.

> I do not know enough about Linux file system yet to come across an
> instruction like that.  That is why I found some other Tutorials for
> Scheme for real beginners.
> 
> I will not be tinkering with reports any time soon.  I had this mental
> block about the word "Script" and just could not understand how one
> builds a Form and Controls with a script.
> 
See my other mail.

> A friend of mine, Chris, who taught me C and C# scolded me yesterday
> about my insistence to using Visual Studio which he pointed out
> "writes the code for the form and controls and their properties for
> you", thus [as he warned me] you never learn how to do it yourself.
> 
Your friend is right to some extent. That is, Visual Studio is a highly integrated development 
environment which facilitates writing applications on Windows. I imagine it's a very powerful 
tool when used as intended by Microsoft. And that's also its weak spot in this context.

GnuCash is not a Windows application from the start. Which means it is built with a totally 
different set of components (also collectively called a framework) that is not integrated at all in 
Visual Studio. So Visual Studio wouldn't be very helpful in the context of gnucash.

guile is only one such component. The GUI libraries we use (gtk+) are another. Visual Studio 
doesn't know about them and hence can't assist you in writing guile reports.

I realize that the hand-holding Visual Studio does when you're making your first steps in a new 
world is very comforting. Unfortunately I don't know of a tool that can offer this same lever of 
comfort for writing gnucash reports in guile.

Hopefully the details I gave in my other mail about how the options and forms work in gnucash 
are a nudge in the right direction.

> And he also pointed out that Scheme is just another Language like C,
> VB, or any other language.
> 
As Colin already pointed out that's quite simplified. Scheme (as an example of a functional 
language) has a totally different programming paradigm than VB or C (which are called 
procedural languages). Don't ask me to explain the differences. I'm still struggling with it myself. 
You can read wikipedia about it if you like.

To use an analogy: if you speak English, chances are it will be relatively easy to learn other 
western languages. It's still a lot of work, but you start from the same mindset. On the other 
hand trying to learn Chinese will be much more difficult because their culture is fundamentally 
different and the reflects in their language and its use.

> So I stand properly chastised, again.

Wow, your friend must be hard-core then :)

Geert


More information about the gnucash-devel mailing list