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

#41 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 15 July 2012 - 10:33 AM

View PostLyqyd, on 14 July 2012 - 10:06 PM, said:

@toxicwolf - Fix submitted for #7 on github.
Thank you for that :P/> Have merged the commit and will test now.

EDIT: The fix doesn't work properly, I've added the information to the issue on github.

Edited by toxicwolf, 16 July 2012 - 09:40 AM.


#42 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 09:38 AM

View PostMysticT, on 14 July 2012 - 12:55 AM, said:

Ok, new version:
Spoiler
Added the scrollable menu, so you can have as many boot files as you want. Also removed the need for file extensions.
I tested it and it works, but there might be bugs anyway.
If there's only one boot file, it loads it and you don't even notice the loader was there :P/>
What file were you saving that code to? I take it you replaced the bios with it, but when I did, peripheral.wrap() throws an error.
Anyway, should there be a way to bypass the bootloader unless you want to boot a different bios than the one that was last time/the one set as default? This way, users won't have to go through the menu each time they want to boot the same OS on a computer that has multiple boot files.

#43 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 16 July 2012 - 02:46 PM

peripheral.wrap is defined in the CraftOS bios, so if you don't start CraftOS before your os (or whatever you were booting) it doesn't exist. If you want to boot an os with this loader, you need to define everything yourself and load all the apis.
Most of the "oses" just load on top of CraftOS, so they are not real oses, they are just custom shells on top of the os.

#44 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 03:31 PM

View PostMysticT, on 16 July 2012 - 02:46 PM, said:

peripheral.wrap is defined in the CraftOS bios, so if you don't start CraftOS before your os (or whatever you were booting) it doesn't exist. If you want to boot an os with this loader, you need to define everything yourself and load all the apis.
Most of the "oses" just load on top of CraftOS, so they are not real oses, they are just custom shells on top of the os.
Yeah, I get that :P/> I just mean, how exactly is the code supposed to be used - when is the file loaded etc.

#45 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 16 July 2012 - 03:50 PM

If you use the one with multi-boot, it will search for files in "/rom/boot", "/boot" and "/disk/boot" (and every disk present). So you just place your os loader in one of those directories and it will be on the menu (or will be loaded if there's no more boot files).

#46 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 05:37 PM

View PostMysticT, on 16 July 2012 - 03:50 PM, said:

If you use the one with multi-boot, it will search for files in "/rom/boot", "/boot" and "/disk/boot" (and every disk present). So you just place your os loader in one of those directories and it will be on the menu (or will be loaded if there's no more boot files).
Ah, no, I mean where does the multi-boot go?

#47 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 16 July 2012 - 06:42 PM

You need to replace bios.lua with that code, like you already did.

#48 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 06:45 PM

View PostMysticT, on 16 July 2012 - 06:42 PM, said:

You need to replace bios.lua with that code, like you already did.
Thought so, but then peripheral.wrap() isn't defined.. Sorry for being slow, by the way.

#49 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 16 July 2012 - 06:51 PM

Like I said before, that's because peripheral.wrap is defined in the CraftOS bios/boot file. So, unless you boot CraftOS (by placing the old bios.lua in a file inside one of the boot paths), it's not defined, it's nil. You have to define it on your os.

#50 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 07:00 PM

So the bootloader already requires CraftOS to run, isn't that kind of backwards? Could you just define peripheral.wrap as a local function in the bootloader?

#51 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 16 July 2012 - 07:07 PM

Ok, now I understand the problem. No, it doesn't require CraftOS, I just didn't test it with disk, so didn't see the error.
New version, fixed the peripheral.wrap error:
Multi-boot version:
Spoiler
Non multi-boot version:
Spoiler


#52 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 07:21 PM

View PostMysticT, on 16 July 2012 - 07:07 PM, said:

Ok, now I understand the problem. No, it doesn't require CraftOS, I just didn't test it with disk, so didn't see the error.
New version, fixed the peripheral.wrap error:
Nice :P/> I had forgotten about the peripheral.call function, makes for a simple work around.

Also, I wondered what your view is on this:

View Posttoxicwolf, on 16 July 2012 - 09:38 AM, said:

Anyway, should there be a way to bypass the bootloader unless you want to boot a different bios than the one that was last time/the one set as default? This way, users won't have to go through the menu each time they want to boot the same OS on a computer that has multiple boot files.
This is about the multiboot, not the other one, since that obviously just loads the first boot file without a fuss.

And could you explain to me about the 'default' thing a bit more? From what I gather, it's a boot file that is loaded above all others, if it's present (with the default file in /rom having a higher priority than the root or a disk). I just am not sure how it would work; would it look for a specific file name?

Edited by toxicwolf, 16 July 2012 - 07:32 PM.


#53 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 16 July 2012 - 08:25 PM

That's what I'm not sure about how it should be implemented. I think looking for an specific file name is the easier way. If someone has any idea on that, I'll like to hear it.

Also, I just figured that it would be better to look first on the computer and then the rom (for the non multi-boot version), since it wouldn't alow oses to load if CraftOS is in the rom. I'll change that later.

#54 toxicwolf

  • Members
  • 201 posts
  • LocationUnited Kingdom

Posted 16 July 2012 - 08:44 PM

View PostMysticT, on 16 July 2012 - 08:25 PM, said:

That's what I'm not sure about how it should be implemented. I think looking for an specific file name is the easier way. If someone has any idea on that, I'll like to hear it.
I think it would also make more sense to a user or server admin too.

#55 PatriotBob

  • New Members
  • 38 posts

Posted 20 July 2012 - 06:47 AM

I looked over a lot of code and while I think the OCL is something computer craft needs, I just don't agree with the way OCL is going about it.

I've been going about writing bios.lua and the rom to some extent to create better seperation.
Bios should handle basic boot device detection and selection.
Once a device is chosen, there needs to be a standard boot loader for all devices. Disks, local stores and rom.

So for the OCL to be successful (read: useful) it needs to provide a standardized bios and mandated boot loader config. Some of these things you have.

But to do it right things have to be separate and concise.
I've been tried to follow current computer hardware separation as much as possible and have been building a *nix based OS on top of it.
Maybe I'm just partial to my implementation though... :P/>

#56 neojames

  • Members
  • 9 posts

Posted 02 September 2012 - 10:09 PM

Whats happend to this? The download link is down and the repo no longer exists. I think a inter-OS compatibility layer is a brillient idea and would love to use it in my programs, but I can't find where I would get it!

#57 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 03 September 2012 - 01:10 AM

There's a fork still up on my github, I believe.

#58 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 03 September 2012 - 02:07 AM

I don't know why toxicwolf removed the repo. I'm working on a new version and will post it when it's ready. It will be a little different, it's based on one of kazagistar's suggestions.

#59 Mailmanq!

  • Members
  • 123 posts
  • LocationI am omnipresent... DUH

Posted 21 November 2012 - 05:47 AM

I like the idea of a custom shell, of course I am too stupid to do it.

#60 comp500

  • Members
  • 66 posts

Posted 19 February 2015 - 05:11 PM

View Postkazagistar, on 13 July 2012 - 05:31 PM, said:

One other thing: what kind of functionality are you assuming is availible to the program? Are you assuming that all the standard libraries exist unchanged? Because I certainly have done my fair share of tinkering with libraries. What if "fs" is modified or removed? The program will silently fail. This should at the very least be made explicit, but here is another proposal: turn this into a more generic "dependancy manager". The interface would let you view what programs and libraries are availible, at what versions. You could load the libraries you need (if they are not loaded) via a standard interface, or run installed apps.

Then, separately, you would define a number of "library interfaces". These could include a read-write interface, a logging interface, a "standard filesystem locations" interface, etc. An OS can implement whichever ones in wants to, and the user can require whichever libraries and programs they want to, and the system would determine if the program can or cannot run in the given environment. The program would look like this:
requireLib("OCL.term", 1.0)
requireLib("OCL.log", 1.0)
requireLib("OCL.paths", 1.0)
requireLib("someNetworkingSystem", 0.32)
requireApp("programCore") -- these could have versions too in theory
requireApp("someDatabase")
OCL.log("Program started")
OCL.term.nPrint("This program is going to call another")
local result = runApp("programCore")
someNetworkingSystem.send(result)
runApp("database","store",result)
-- etc
requireLib would make sure the library exists at the correct version. It might load the library from a file if needed or whatever else the OS writer decides. If it cannot load a correct version of the library into the current global namespace for whatever reason, it will throw an error. Thus, the program writer will be assured that all the correct functionality exists, and the user will be informed with a helpful error message infoming them exactly what is missing from their system.

PS: Could you please license it? Linking or distributing non-licensed copyrighted code is illegal, so it would be helpful if you tossed in some kind of disclaimer or whatever allowing usage. I am a big fan of WTFPL, but whatever you prefer.
I can't find the code for OCL (github 404, dropbox 401) but I have made a require() function... it could be used with a package manager (like in npm) to install the packages as dependencies... or something like that.
http://www.computerc...o-include-apis/

also another thought, this sort of thing could implement POSIX, or some CC equivalent





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users