int main(int argv, char** argc) { if (argv == 1) { std::cerr << "Must provide a command and arguments! Try parse, rewrite, compile, assemble\n"; return 0; } std::string flag = ""; std::string command = argc[1]; std::string input; std::string secondInput; if (std::string(argc[1]) == "-s") { flag = command.substr(1); command = argc[2]; input = ""; std::string line; while (std::getline(std::cin, line)) { input += line + "\n"; } secondInput = argv == 3 ? "" : argc[3]; } else { if (argv == 2) { std::cerr << "Not enough arguments for serpent cmdline\n"; throw(0); } input = argc[2]; secondInput = argv == 3 ? "" : argc[3]; } bool haveSec = secondInput.length() > 0; if (command == "parse" || command == "parse_serpent") { std::cout << printAST(parseSerpent(input), haveSec) << "\n"; } else if (command == "rewrite") { std::cout << printAST(rewrite(parseLLL(input, true)), haveSec) << "\n"; } else if (command == "compile_to_lll") { std::cout << printAST(compileToLLL(input), haveSec) << "\n"; } else if (command == "build_fragtree") { std::cout << printAST(buildFragmentTree(parseLLL(input, true))) << "\n"; } else if (command == "compile_lll") { std::cout << binToHex(compileLLL(parseLLL(input, true))) << "\n"; } else if (command == "dereference") { std::cout << printAST(dereference(parseLLL(input, true)), haveSec) <<"\n"; } else if (command == "pretty_assemble") { std::cout << printTokens(prettyAssemble(parseLLL(input, true))) <<"\n"; } else if (command == "pretty_compile_lll") { std::cout << printTokens(prettyCompileLLL(parseLLL(input, true))) << "\n"; } else if (command == "pretty_compile") { std::cout << printTokens(prettyCompile(input)) << "\n"; } else if (command == "assemble") { std::cout << assemble(parseLLL(input, true)) << "\n"; } else if (command == "serialize") { std::cout << binToHex(serialize(tokenize(input, Metadata(), false))) << "\n"; } else if (command == "flatten") { std::cout << printTokens(flatten(parseLLL(input, true))) << "\n"; } else if (command == "deserialize") { std::cout << printTokens(deserialize(hexToBin(input))) << "\n"; } else if (command == "compile") { std::cout << binToHex(compile(input)) << "\n"; } else if (command == "encode_datalist") { std::vector<Node> tokens = tokenize(input); std::vector<std::string> o; for (int i = 0; i < (int)tokens.size(); i++) { o.push_back(tokens[i].val); } std::cout << binToHex(encodeDatalist(o)) << "\n"; } else if (command == "decode_datalist") { std::vector<std::string> o = decodeDatalist(hexToBin(input)); std::vector<Node> tokens; for (int i = 0; i < (int)o.size(); i++) tokens.push_back(token(o[i])); std::cout << printTokens(tokens) << "\n"; } else if (command == "tokenize") { std::cout << printTokens(tokenize(input)); } else if (command == "biject") { if (argv == 3) std::cerr << "Not enough arguments for biject\n"; int pos = decimalToUnsigned(secondInput); std::vector<Node> n = prettyCompile(input); if (pos >= (int)n.size()) std::cerr << "Code position too high\n"; Metadata m = n[pos].metadata; std::cout << "Opcode: " << n[pos].val << ", file: " << m.file << ", line: " << m.ln << ", char: " << m.ch << "\n"; } }
void MediaPlayer2Player::totalTimeChanged() const { QVariantMap properties; properties["Metadata"] = Metadata(); Mpris2::signalPropertiesChange(this, properties); }
/*static*/ already_AddRefed<mozilla::MediaByteBuffer> MP4Metadata::Metadata(Stream* aSource) { auto parser = mozilla::MakeUnique<MoofParser>(aSource, 0, false); return parser->Metadata(); }
void CNcdNodeActivate::ActivateL() { DLTRACEIN(("")); // Note that ownership is not transferred here. // So, do not add to the cleanup stack. // When the items have been installed, they may be activated. // Install proxy contains theme name and file information that // can be used to activate items. CNcdNodeInstallProxy* install( Metadata().Install() ); if ( install != NULL && install->IsInstalledL() ) { // Create the service that can handle activations MNcdDeviceService* service( NcdDeviceInteractionFactory::CreateDeviceServiceLC() ); if ( service == NULL ) { DLERROR(("Could not create service for active interface")); // For debugging purposes DASSERT( EFalse ); User::Leave( KErrNotFound ); } // Now we have the install interface to use and to check if some // of its material could be activated. Activation may be done // after the item has been installed. // NOTICE: If you add or remove functionality here, // then remember to update the CNcdNodeProxy::InternalizeActivateL() // function accordingly. So, the MNcdNodeActivate interface can be // provided from the API in correct situations. RCatalogsArray<MNcdInstalledContent> content( install->InstalledContentL() ); CleanupResetAndDestroyPushL( content ); TBool setSomething = EFalse; for ( TInt i = 0; i < content.Count(); ++i ) { MNcdInstalledTheme* theme = content[i]->QueryInterfaceLC<MNcdInstalledTheme>(); if ( theme ) { SetThemeL( *theme, *service ); setSomething = ETrue; CleanupStack::PopAndDestroy( theme ); break; } MNcdInstalledFile* file = content[i]->QueryInterfaceLC<MNcdInstalledFile>(); if ( file ) { SetContentFileL( *file, *install, *service ); setSomething = ETrue; CleanupStack::PopAndDestroy( file ); break; } } CleanupStack::PopAndDestroy( &content ); if ( !setSomething ) { User::Leave( KErrNotFound ); } CleanupStack::PopAndDestroy( service ); } DLTRACEOUT(("")); }
/* * Sifteo SDK Example. */ #include "game.h" AssetSlot MainSlot = AssetSlot::allocate() .bootstrap(BootAssets); static Metadata M = Metadata() .title("Forrest") .package("com.playperro.forrest", "0.1") .icon(Icon) .cubeRange(NUM_CUBES); void main() { static Game game; while (1) { game.title(); game.init(); game.run(); game.cleanup(); } }
/* * Sifteo SDK Example. */ #include "game.h" AssetSlot MainSlot = AssetSlot::allocate() .bootstrap(BootAssets); static Metadata M = Metadata() .title("Membrane") .package("com.sifteo.sdk.membrane", "1.0") .icon(Icon) .cubeRange(NUM_CUBES); void main() { static Game game; while (1) { game.title(); game.init(); game.run(); game.cleanup(); } }
// Convert metadata from python wrapper form Metadata cppifyMetadata(PyObject* o) { std::string file = cppifyString(PyList_GetItem(o, 0)); int ln = cppifyInt(PyList_GetItem(o, 1)); int ch = cppifyInt(PyList_GetItem(o, 2)); return Metadata(file, ln, ch); }
* */ #ifndef SHARE_VM_OOPS_METADATA_HPP #define SHARE_VM_OOPS_METADATA_HPP #include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/ostream.hpp" // This is the base class for an internal Class related metadata class Metadata : public MetaspaceObj { // Debugging hook to check that the metadata has not been deleted. NOT_PRODUCT(int _valid;) public: NOT_PRODUCT(Metadata() { _valid = 0; }) NOT_PRODUCT(bool is_valid() const volatile { return _valid == 0; }) int identity_hash() { return (int)(uintptr_t)this; } // Rehashing support for tables containing pointers to this unsigned int new_hash(juint seed) { ShouldNotReachHere(); return 0; } virtual bool is_klass() const volatile { return false; } virtual bool is_method() const volatile { return false; } virtual bool is_methodData() const volatile { return false; } virtual bool is_constantPool() const volatile { return false; } virtual const char* internal_name() const = 0; void print() const { print_on(tty); }
// Convert pyobject string into normal form std::string cppifyString(PyObject* o) { const char *command; if (!PyArg_Parse(o, "s", &command)) err("Argument should be string", Metadata()); return std::string(command); }
// Convert pyobject int into normal form int cppifyInt(PyObject* o) { int out; if (!PyArg_Parse(o, "i", &out)) err("Argument should be integer", Metadata()); return out; }
#define MUSIC_CHANNEL 0 #define PORTAL_CHANNEL 1 #define BALL_SFX_CHANNEL 2 #define BOARD_SFX_CHANNEL 3 #define BALL_ROLL_CHANNEL 4 #define BALL_HIT_CHANNEL 5 #define REPEAT channels[0]->REPEAT //Annoying enums within classes... #define MAX_VOLUME channels[0]->MAX_VOLUME static AssetSlot MainSlot = AssetSlot::allocate() .bootstrap(GameAssets); static Metadata M = Metadata() .title("Siftrinth") .package("com.markh.siftrinth", "1.0") .icon(Icon) .cubeRange(NUM_CUBES); static CubeBoard boards[NUM_CUBES]; static short g_starsCollected[NUM_CUBES]; static bool g_bColorsUsed[NUM_COLORS]; static int g_iCurMode; static int g_iScore; static int g_iBoardReset; //What board to reset if it's empty static AudioChannel* channels[6]; int findNextColor() { for(int i = 0; i < NUM_COLORS; i++) {
void Mpris2::slotCurrentSourceChanged() { EmitPropertyChanged("Metadata", Metadata()); EmitPropertyChanged("CanSeek", CanSeek()); }
/* * Phonemic tool */ #include "phonemic.h" // METADATA static Metadata M = Metadata() .title("Phonemic") .package("com.sifteo.phonemic", "0.2.1") .icon(Icon) .cubeRange(1, CUBE_ALLOCATION); AssetSlot gMainSlot = AssetSlot::allocate() .bootstrap(BootstrapAssets); AssetSlot gWord1 = AssetSlot::allocate() .bootstrap(WordAssets); AssetSlot gWord2 = AssetSlot::allocate() .bootstrap(WordAssets2); AssetSlot gWord3 = AssetSlot::allocate() .bootstrap(WordAssets3); // NEED A MENU: // + Word Families // - \e\ // - \f\ // ... // + Free Play // + Exit // NEED CLASSES?: