Jump to content




OCL [Operating System Compatibility Layer] 0.4

utility api lua

59 replies to this topic

Poll: OCL (21 member(s) have cast votes)

What is your opinion of the OCL? - Tell me why in the comments!

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Vote

#1 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 09 July 2012 - 10:13 AM

Latest News:


-OCL has now been added to GitHub!



The OCL is designed to act as an interface between custom Operating Systems, and core ComputerCraft functions. This allows program writers to make a program that will run smoothly on any of the OCL compatible OSs. All OS developers need to do to become compatible with the OCL is to adapt the CraftOS version of the api file to their Operating System - the custom OCL shell does the rest!

The OCL also allows for OSs to have custom shell files, without overwriting the default shell in the rom/ folder. The custom OCL shell file does replace the original ComputerCraft one, however it retains all default behaviour. The only additions are loading of the OCL api file (either the custom OS's one, or the CraftOS one) and then loading of the custom shell - if there is one. If not, it will behave like normal.

Rather than program writers re-writing their program many times to provide certain compatibility with different OSs, they may use the OCL functions instead, which will be handled by the currently loaded, OCL compatible Operating System.

The OCL will be better and more useful if more OSs join the project! Any developers are free to suggest features or code to be added to the project - it may provide extra compatibility with certain Operating Systems!

Quote

Installation

There is a client (or user) installation required. Just open up the zip archive and drag and drop the 'mods' folder into your '.minecraft' folder, allowing your computer to merge and replace folders and files.
And that's it! The only difference the user will see is the OS version upon boot, which will also include the OCL version number. Apart from that, there should be no other visual difference.


Quote

Developers

For program writers wishing to use the OCL in their program(s), a function list may be found in the 'Documentation' section of the README.txt found in the zip archive.

For Operating System developers wishing to make their OS compatible with the OCL, take a look at the OCL file included in the archive. It is written for CraftOS, however it serves as a good template for what you should include in your version of the OCL file.
Some functions require little to no changes, as they just make calls to other internal functions; however other functions do need adapting to how your OS runs. In most cases this will probably just be function calls to your own functions from within your OS that already do the same thing.
Do not change the structure of the file in any way, including adding/removing/changing functions or function arguments, as it will cause issues.

The best way to check if the client has the OCL installed (to keep compatibility with non-OCL clients) is to attempt to call an OCL function. Since the shell will automatically load any OCL api files, attempting to call a function when the api hasn't been loaded will fail.

If you want to help add to the OCL, or require further changes/additions to the project for your OS to work with it, please feel free to contact me here, or at my email address (found inside the files). Also, feel free to make pull requests on the OCL GitHub page, and I will look at merging your additions!


Quote

Downloads:

OCL 0.4

Toxic Wolf

Edited by toxicwolf, 10 July 2012 - 10:43 PM.


#2 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 09 July 2012 - 12:02 PM

I think our OS will become Compatible with OCL :)/>
EDIT: And: Good Idea!

#3 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 09 July 2012 - 03:45 PM

View Postardera, on 09 July 2012 - 12:02 PM, said:

I think our OS will become Compatible with OCL B)/>
EDIT: And: Good Idea!
Thanks! Of course at the moment I'm also adding compatibility for the OCL to my own OS, WolfOS :)/>

EDIT: If you have already downloaded a copy of the OCL, please re-download, as I have just hotfixed a couple of issues.

Edited by toxicwolf, 09 July 2012 - 09:19 PM.


#4 Mendax

  • Members
  • 366 posts

Posted 09 July 2012 - 10:01 PM

Wow, OCL looks good. ShadOS will become compatible. (Quick tip: OSCL makes more sense to newbs but sounds pretty bad. If you like OCL just leave it :)/> .)

#5 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 09 July 2012 - 10:06 PM

View Postmrminer84403, on 09 July 2012 - 10:01 PM, said:

Wow, OCL looks good. ShadOS will become compatible. (Quick tip: OSCL makes more sense to newbs but sounds pretty bad. If you like OCL just leave it B)/> .)
Thank you! If there's any specific additions you need for your OS to work better with the OCL, then feel free to tell me! That goes for anyone else too B)/>

And I did originally think of OSCL as an acronym when I came up with the name, but I also thought it sounded bad :)/> I think for now, I will stick with it B)/>

#6 Mendax

  • Members
  • 366 posts

Posted 10 July 2012 - 01:12 PM

So, how do I actually change all these outside the rom? make a ShadOS API? (My OS is a 'Footprint' OS.)

#7 ardera

  • Members
  • 503 posts
  • LocationGermany

Posted 10 July 2012 - 03:04 PM

what about a Config file, where youre OS can change the Settings?

#8 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 10 July 2012 - 03:52 PM

View Postardera, on 10 July 2012 - 03:04 PM, said:

what about a Config file, where youre OS can change the Settings?
What settings are you talking about? I'm sorry I just don't really understand your post :)/>

View Postmrminer84403, on 10 July 2012 - 01:12 PM, said:

So, how do I actually change all these outside the rom? make a ShadOS API? (My OS is a 'Footprint' OS.)
Create a copy of the OCL file, and customise it for your OS. Then make sure that it is installed/saved into this directory: //OCL/OCL That is, the OCL file is saved inside a folder called OCL in the root of the computer that your OS is being installed to in game. Like I said, the new shell will take care of the rest.

I will also be making example OSs and programs etc soon!

#9 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 10 July 2012 - 06:49 PM

My OS won't be compatible (at least for now), since it changes the boot, so the shell is never executed. Maybe I'll add an OCL api with all the functions, so it still works, but not for now.

I think it would be better to have a common boot method, to be able install different oses at the same time and have a multiboot to use the one you want.
I have already a multiboot system that we could use, there's some things that could be changed/improved, but it works fine.

#10 minizbot2012

  • Members
  • 122 posts
  • LocationPalm Bay, Florida

Posted 10 July 2012 - 07:38 PM

i believe this is a bug but my startup programs are not running when i run this, i am not using a custom OS or anything like that, just craftOS.

#11 Mendax

  • Members
  • 366 posts

Posted 10 July 2012 - 09:13 PM

Ok, easy enough. I'll have a go.

#12 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 10 July 2012 - 10:34 PM

View Postminizbot2012, on 10 July 2012 - 07:38 PM, said:

i believe this is a bug but my startup programs are not running when i run this, i am not using a custom OS or anything like that, just craftOS.
Not sure what's causing that... I've tested the files and between the OCL shell and the CraftOS version of the OCL api, all default behaviour is maintained. Event without the OCL api file, the shell will just behave like normal.
Don't suppose you can give me anything else to go on? And is it just disk/startup file that aren't working, or startup files on the root as well? :)/>

View PostMysticT, on 10 July 2012 - 06:49 PM, said:

My OS won't be compatible (at least for now), since it changes the boot, so the shell is never executed. Maybe I'll add an OCL api with all the functions, so it still works, but not for now.

I think it would be better to have a common boot method, to be able install different oses at the same time and have a multiboot to use the one you want.
I have already a multiboot system that we could use, there's some things that could be changed/improved, but it works fine.
I take it you mean a standardised bios.lua file? And I think I looked at your multi-boot code a while back, but may I have access to it? B)/>

View Postmrminer84403, on 10 July 2012 - 09:13 PM, said:

Ok, easy enough. I'll have a go.
Great B)/> Just shout for any help or additions etc, like I said! :)/>

If anyone uses github, the link is in the OP, so please fork & pull request any changes etc you make! B)/>

#13 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 10 July 2012 - 10:54 PM

Sure, here's the current code:
Spoiler
You need to move bios.lua to rom/CraftOS_1_3.startup, and then replace bios.lua with that code. It will look for a "boot" file or directory in the computer, and if it's present it will boot from it, otherwise it loads CraftOS (from the file you moved).
I wanted to remove the write and print functions or make them smaller. If you have any suggestion, I'll try to implement it.

#14 minizbot2012

  • Members
  • 122 posts
  • LocationPalm Bay, Florida

Posted 11 July 2012 - 01:15 AM

It is both startup files, I'll take a look at it again tomorrow. I'll also be checking out wolfOS.

#15 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 11 July 2012 - 08:21 AM

View Postminizbot2012, on 11 July 2012 - 01:15 AM, said:

It is both startup files, I'll take a look at it again tomorrow. I'll also be checking out wolfOS.
I'm running the OCL in my world currently, and the startups are definitely working, because I was doing a lot of WolfOS testing yesterday. Can you just confirm that you installed the shell and api file correctly?

View PostMysticT, on 10 July 2012 - 10:54 PM, said:

Sure, here's the current code:
Spoiler
You need to move bios.lua to rom/CraftOS_1_3.startup, and then replace bios.lua with that code. It will look for a "boot" file or directory in the computer, and if it's present it will boot from it, otherwise it loads CraftOS (from the file you moved).
I wanted to remove the write and print functions or make them smaller. If you have any suggestion, I'll try to implement it.
Okay, thanks B)/> I will see about implementing some kind of multi-boot system into the OCL, or something :)/>

#16 minizbot2012

  • Members
  • 122 posts
  • LocationPalm Bay, Florida

Posted 11 July 2012 - 11:25 AM

View Posttoxicwolf, on 11 July 2012 - 08:21 AM, said:

View Postminizbot2012, on 11 July 2012 - 01:15 AM, said:

It is both startup files, I'll take a look at it again tomorrow. I'll also be checking out wolfOS.
I'm running the OCL in my world currently, and the startups are definitely working, because I was doing a lot of WolfOS testing yesterday. Can you just confirm that you installed the shell and api file correctly?
i did install the shell and the API file correctly

#17 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 11 July 2012 - 01:30 PM

View Posttoxicwolf, on 11 July 2012 - 08:21 AM, said:

Okay, thanks B)/> I will see about implementing some kind of multi-boot system into the OCL, or something :)/>
The multi-boot is actually in another file, wich is placed as boot/loader. It checks for files with .startup extension, and shows a menu to choose wich one to boot.
In the .startup file you put all the code to start your os, load every api (since there's no apis loaded, wich is better to make an os) and start the shell (GUI or text-based). This can be changed, but we should make a system that every os follows, so you can have all of them B)/>

#18 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 11 July 2012 - 03:27 PM

View PostMysticT, on 11 July 2012 - 01:30 PM, said:

View Posttoxicwolf, on 11 July 2012 - 08:21 AM, said:

Okay, thanks B)/> I will see about implementing some kind of multi-boot system into the OCL, or something :)/>
The multi-boot is actually in another file, wich is placed as boot/loader. It checks for files with .startup extension, and shows a menu to choose wich one to boot.
In the .startup file you put all the code to start your os, load every api (since there's no apis loaded, wich is better to make an os) and start the shell (GUI or text-based). This can be changed, but we should make a system that every os follows, so you can have all of them B)/>
Thanks :)/> I will have a think about how it will work exactly.The current custom shell thing will be made defunct by this new change, but it makes sense B)/>

View Postminizbot2012, on 11 July 2012 - 11:25 AM, said:

View Posttoxicwolf, on 11 July 2012 - 08:21 AM, said:

View Postminizbot2012, on 11 July 2012 - 01:15 AM, said:

It is both startup files, I'll take a look at it again tomorrow. I'll also be checking out wolfOS.
I'm running the OCL in my world currently, and the startups are definitely working, because I was doing a lot of WolfOS testing yesterday. Can you just confirm that you installed the shell and api file correctly?
i did install the shell and the API file correctly
Hmm.. I honestly don't know what's up with that... Does the string "CraftOS 1.33 - OCL 0.4" appear on the computer after boot? Also, can someone else confirm a working installation of OCL 0.4?

#19 minizbot2012

  • Members
  • 122 posts
  • LocationPalm Bay, Florida

Posted 11 July 2012 - 07:08 PM

yes the craftOS with the OCL is showing up, it is not launching the startup.

#20 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 11 July 2012 - 07:49 PM

View Postminizbot2012, on 11 July 2012 - 07:08 PM, said:

yes the craftOS with the OCL is showing up, it is not launching the startup.
Okay, then check that the following code is present in the shell file:
-- If this is the toplevel shell, run the startup programs
if parentShell == nil then
-- Run the startup from the ROM first
local sRomStartup = shell.resolveProgram( "/rom/startup" )
if sRomStartup then
  shell.run( sRomStartup )
end

-- Then run the user created startup, from the disks or the root
local sUserStartup = shell.resolveProgram( "/startup" )
for n,sSide in pairs( redstone.getSides() ) do
  if disk.isPresent( sSide ) and disk.hasData( sSide ) then
   local sDiskStartup = shell.resolveProgram( fs.combine(disk.getMountPath( sSide ), "startup") )
   if sDiskStartup then
    sUserStartup = sDiskStartup
    break
   end
  end
end

if sUserStartup then
  shell.run( sUserStartup )
end
end
It can be found directly after the print() function on line 152 that prints the CraftOS version and OCL version number.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users