GithubHelp home page GithubHelp logo

ingwiephoenix / objectscript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from unitpoint/objectscript

0.0 2.0 0.0 46.78 MB

ObjectScript is a new embedded programing language that mixes benefits of JavaScript, Lua, Ruby, Python and PHP. The ObjectScript has syntax from JavaScript, multiple results from Lua, sugar syntax from Ruby, magic methods from Python and much more.

Home Page: http://objectscript.org

License: Other

Shell 0.02% C++ 25.94% C 55.76% Makefile 0.03% CSS 0.09% XSLT 0.13% Perl 0.04% Vim Script 0.06% CMake 0.93% HTML 16.64% Inno Setup 0.02% DIGITAL Command Language 0.27% Groff 0.04% Smarty 0.05% Batchfile 0.01%

objectscript's Introduction

ObjectScript

ObjectScript, OS for short, is a new programming language. It's free, cross-platform, lightweight, embeddable and open-source. It combines the benefits of multiple languages, including: JavaScript, Lua, Ruby, Python and PHP. OS features the syntax of Javascripts, the "multiple results" feature from lua, syntactic shugar from Ruby as well as magic methods from PHP and Ruby - and even more!

The ObjectScript is universal scripting language, there are no compromises any more.

Compile and Install os-fcgi and os

Run the following commands after you have cloned this repository:

mkdir build && cd build
cmake ..
make
make install

If you are on an operating system like Debian or Ubuntu, you can then start os-fcgi by typing:

service os-fcgi start

Installing the Database layer

During the configuration, you may notice that a library named SoCi could not be found. This is the database abstraction which is used by ObjectScript's ext-odbo module. You can build SoCi alongside OS by using the following CMake command instead of the one given above:

cmake .. -DBUILD_SOCI=ON

After that, you should be good to go.

Special note for Apple Mac OS X builds

Depending on how you have installed MySQL on your system, you may run into this error by running os or os-fcgi from the build directory or after you have installed it:

dyld: Library not loaded: libmysqlclient.18.dylib
  Referenced from: /usr/local/bin/os
  Reason: image not found

Or similar. To fix this, do as follows:

# Navigate back into your build folder if you have previously left it
cd build
../contrib/change_install_name.sh

This will update all the binaries within your build folder and make them find the library - hopefuly.

Using ObjectScript in your app

After installing ObjectScript, you also will get the required headers into your system to utilize ObjectScript in your app. This is especially useful to let the user do something within your app. Here is an example:

app.cpp:

#include <objectscript.h>

using namespace ObjectScript;

int main(int argc, char** argv) {
	OS* os = OS::create();

	// simulate calling "print()" with given argv
	os->getGlobal("print");
	os->newArray(argc);
	for(int i=0; i<argc; i++) {
		os->pushString(argv[i]);
		os->addProperty(-2);
	}
	os->callF(1);
}

Now, compile it just like this:

g++ app.cpp -o app -lobjectscript

To do so on Windows, copy the resulting libobjectscript.lib and src/objectscript.h to your project, and compile as:

cl app.cpp libobjectscript.lib /I. /Fe:app

The library and headers are installed globally into your installation path's include folder.

Nginx config example (for os-fcgi)

server {
	listen			80;
	server_name		mydomain.com www.mydomain.com;
	root			/home/myuser/mydomain.com/www;
	error_log		/var/log/nginx/error.mydomain.com.log;
	access_log		off;
	location ~ /\.ht {
		deny all;
	}
	location ~ /\.git {
		deny all;
	}
	location / {
		try_files $uri $uri/ /index.osh /index.os;
	}
	location ~* \.(jpg|jpeg|png|gif|swf|flv|mp4|mov|avi|wmv|m4v|mkv|ico|js|css|txt)$ {
		access_log off;
		expires 7d;
	}
	charset	utf-8;
	location ~ ^.+\.osh? {
		fastcgi_split_path_info	^(.+?\.osh?)(.*)$;
		fastcgi_pass	127.0.0.1:9000;
		fastcgi_index	index.osh;
		include fastcgi_params;
		fastcgi_intercept_errors	on;
		fastcgi_ignore_client_abort	on;
		fastcgi_read_timeout	360;
	}
}

Apache config example (for os-fcgi)

<VirtualHost mydomain.com:80>
	ServerAdmin [email protected]
	DocumentRoot "/home/myuser/mydomain.com/www"
	ServerName mydomain.com

	FastCgiExternalServer "/home/myuser/mydomain.com/www" -host 127.0.0.1:9000

	<Directory "/home/myuser/mydomain.com/www">
		# SetHandler fastcgi-script
		AddHandler fastcgi-script .osh
		AddHandler fastcgi-script .os
		Options Indexes FollowSymLinks MultiViews ExecCGI
		AllowOverride all
		Order Deny,Allow
		Deny from all
		Allow from 127.0.0.1
	</Directory>
</VirtualHost>

Resources

##Contacts

Please feel free to contact me at anytime, my email is [email protected], skype: egolovin

P.S. old files of this repo have been moved to https://github.com/unitpoint/objectscript-old

objectscript's People

Contributors

hoopoepg avatar unitpoint avatar igor-bogomolov avatar aperezdc avatar mvpetrov avatar

Watchers

James Cloos avatar Ingwie Phoenix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.