GithubHelp home page GithubHelp logo

theos / logos Goto Github PK

View Code? Open in Web Editor NEW
194.0 9.0 32.0 524 KB

Preprocessor that simplifies Objective-C hooking.

Home Page: https://theos.dev/docs/logos

License: Other

Perl 96.97% Vim Script 3.03%
theos logos

logos's Introduction

Logos

Logos is a Perl regex-based preprocessor that simplifies the boilerplate code needed to create hooks for Objective-C methods and C functions with an elegant Objective-C-like syntax. It’s most commonly used along with the Theos build system, which was originally developed to create jailbreak tweaks. Logos was once integrated in the same Git repo as Theos, but now has been decoupled from Theos to its own repo.

Logos aims to provide an interface for Cydia Substrate by default, but can be configured to directly use the Objective-C runtime.

Documentation is available on the Logos Syntax, Logify, and File Extensions pages of theos.dev.

Example

Source file: Tweak.x

%hook NSObject

- (NSString *)description {
	return [%orig stringByAppendingString:@" (of doom)"];
}

%new
- (void)helloWorld {
	NSLog(@"Awesome!");
}

%end

Logos-processed output: Tweak.x.m

(Modified for brevity)

#include <substrate.h>

static NSString *_logos_method$_ungrouped$NSObject$description(NSObject *self, SEL _cmd) {
	return [_logos_orig$_ungrouped$NSObject$description(self, _cmd) stringByAppendingString:@" (of doom)"];
}

static void _logos_method$_ungrouped$NSObject$helloWorld(NSObject * self, SEL _cmd) {
	NSLog(@"Awesome!");
}

static __attribute__((constructor)) void _logosLocalInit() {
	Class _logos_class$_ungrouped$NSObject = objc_getClass("NSObject");

	MSHookMessageEx(_logos_class$_ungrouped$NSObject, @selector(description), (IMP)&_logos_method$_ungrouped$NSObject$description, (IMP*)&_logos_orig$_ungrouped$NSObject$description);

	class_addMethod(_logos_class$_ungrouped$NSObject, @selector(helloWorld), (IMP)&_logos_method$_ungrouped$NSObject$helloWorld, "v@:");
}

License

Licensed under the GNU General Public License, version 3.0, with an exception that projects created using Logos are not required to use the same license. Refer to LICENSE.md.

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.