/** * hello.c * A simple Racket extension that provides the "hello" method. * * Copyright (c) 2013 Samuel A. Rebelsky. All rights reserved. * * This file is part of The Glimmer Guide to Writing Racket Extensions * (GGWRE). * * GGWRE is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GGWRE is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GGWRE. If not, see . */ // +---------+--------------------------------------------------------- // | Headers | // +---------+ #include #include // +------------+------------------------------------------------------ // | Extensions | // +------------+ Scheme_Object * hi (int argc, Scheme_Object *argv[]) { return scheme_make_locale_string ("Hello"); } // hi // +---------------------+--------------------------------------------- // | Standard Procedures | // +---------------------+ Scheme_Object * scheme_initialize (Scheme_Env *env) { return scheme_reload (env); } // scheme_initialize Scheme_Object * scheme_module_name (void) { return scheme_intern_symbol ("ello"); } // scheme_module_name Scheme_Object * scheme_reload (Scheme_Env *env) { Scheme_Object *proc; proc = scheme_make_prim_w_arity (hi, "hello", 0, 0); scheme_add_global ("hello", proc, env); proc = scheme_make_prim_w_arity (hi, "hello1", 0, 0); scheme_add_global ("hello2", proc, env); scheme_add_global ("hello3", proc, env); return scheme_void; } // scheme_reload