OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 8:22 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Thu Nov 06, 2014 6:08 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
KemyLand wrote:
Didn't noticed this topic #-o I was excepting it long ago :wink:
Feel free to give it a try, happy to hear critique! :)

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Sat Nov 22, 2014 11:30 am 
Offline
Member
Member
User avatar

Joined: Tue Dec 27, 2011 7:57 am
Posts: 368
HELLO MAX

After using makefiles for years, I've finally decided to switch, because they were mostly giving me headaches.
I have to say, in 20 minutes of using Capri, it's effing-fantastic.

Three things though:
1. Is it possible to define a variable at top-level of a Capri script 'statically'? Right now I'm trying to have a so-called 'project directory' using File.getCurrentDirectory(). Unfortunately, including this root-level build.capri script recomputes the function call, so I can't get a statically defined variable like that without hard coding it...

2. Somewhat related to (1), is it possible to dynamically import scripts at runtime? For instance looping through some files in a folder and calling import "{file}"; would be really cool!

3. Bug report... Unfortunately. Doing something like this:
Code:
task all depends build, buildLib;
task build depends compile, link;

task compile { ... }
task link { ... }
task buildLib { ... }



somehow results in a "dependency failed for task 'all'"... except both compile and link are actually called, and return true.
After some digging, replacing
Code:
task build depends compile, link;


with
Code:
task build { compile(); link(); }


Solves the issue. Just a small bug, not exactly disastrous but hopefully worth looking into, yes?
Thanks! You have successfully rid me of my makefile addiction, hopefully this goes open source soon!

_________________
[nx] kernel: http://github.com/zhiayang/nx


Top
 Profile  
 
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Sat Nov 22, 2014 12:07 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
Hello requimrar :)

Thanks a lot for the kind words and the feedback. Happy to see that its of use for others!

1. Could you give me an example? Yes it is possible to create a variable, task or simply write statements in the global scope.
2. Not yet, I've added it to my list :)
3. This is indeed not the way it should be, but I have a suspicion. Will update once fixed.

You can already get the sources in the capri release folder. I'm working on a website with a documentation, and also a public repository :)

Greets, Max

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Sat Nov 22, 2014 1:03 pm 
Offline
Member
Member
User avatar

Joined: Tue Dec 27, 2011 7:57 am
Posts: 368
Hey max, thanks for your quick reply.
To clarify, what I meant by the first point was this: say I have this code in "toplevel/build.capri"
Code:
projDir   = File.getCurrentDirectory();
sysroot    = File.getAbsolutePath("{projDir}/build/sysroot");


Of course, this also defines a few more global variables like CXX etc, for convenience.
In "toplevel/sublevel/sublevel2/build.capri, I have this:"
Code:
import "../../build.capri";
...

somethingRandom = "{sysroot}/usr/include";



What happens here is that 'sysroot' in the second file is computed using its context, meaning it is essentially
Code:
File.getAbsolutePath("{File.getCurrentDirectory()}/build/sysroot");


This means {sysroot}, to the sublevel capri script, is not 'toplevel/build/sysroot', but instead 'toplevel/sublevel/sublevel2/build/sysroot'.



PS: What can go inside the string-substitution curly braces {}? Just variable identifiers, or are arbitrary expressions (function calls) also allowed?
PPS: I might have another bug:
Code:
task something depends somethingElse
{

}


The task 'something' doesn't work properly in this case, I need to manually call somethingElse() from within it...
Anyway, it's still a fantastic job!

_________________
[nx] kernel: http://github.com/zhiayang/nx


Top
 Profile  
 
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Sat Nov 22, 2014 1:12 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
Oh, I see what you mean. This issue happens because getCurrentDirectory returns the directory in which capri is currently working in = the executed script location; anything that is imported is executed as if it was in the same script. I'll add something to work around this.

For the second thing, I've messed something up with the dependencies (as your previous example shows), I'll have a look over this stuff.

Thanks a lot for your feedback. Will add an update once this is fixed. ;)

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Sun Nov 23, 2014 1:38 am 
Offline
Member
Member
User avatar

Joined: Tue Dec 27, 2011 7:57 am
Posts: 368
Thanks! (also, would it be possible to release a text mate syntax file for capri?)

_________________
[nx] kernel: http://github.com/zhiayang/nx


Top
 Profile  
 
 Post subject: Re: Capri 1.16 beta release!
PostPosted: Wed Dec 03, 2014 2:37 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
requimrar wrote:
Thanks! (also, would it be possible to release a text mate syntax file for capri?)

I'll create a BNF for Capri, I've never written a textmate syntax file, but feel free to contribute if you made one ;)
Sorry for the late reply, was sick, now working on bugfixes. :)

EDIT: Ah, to
requimrar wrote:
PS: What can go inside the string-substitution curly braces {}? Just variable identifiers, or are arbitrary expressions (function calls) also allowed?
You can put any expression in there, everything in there is interpreted and the return value (or for a simple variable the variable value) is inserted right at that location.
For example, a "Hello world" can be this:
Code:
task print {
   Utils.print("Hello ");   
   return "world";
}
Utils.println("{print()}");

_________________
Ghost OS - GitHub


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group