~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Source/Modules/chicken.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * CHICKEN language module for SWIG.
8
8
 * ----------------------------------------------------------------------------- */
9
9
 
10
 
char cvsroot_chicken_cxx[] = "$Id: chicken.cxx 10562 2008-06-23 21:14:53Z wsfulton $";
 
10
char cvsroot_chicken_cxx[] = "$Id: chicken.cxx 11133 2009-02-20 07:52:24Z wsfulton $";
11
11
 
12
12
#include "swigmod.h"
13
13
 
30
30
static char *chicken_path = (char *) "chicken";
31
31
static int num_methods = 0;
32
32
 
 
33
static File *f_begin = 0;
33
34
static File *f_runtime = 0;
34
35
static File *f_header = 0;
35
36
static File *f_wrappers = 0;
101
102
  int isPointer(SwigType *t);
102
103
  void dispatchFunction(Node *n);
103
104
 
104
 
  String *chickenNameMapping(String *, String_or_char *);
 
105
  String *chickenNameMapping(String *, const_String_or_char_ptr );
105
106
  String *chickenPrimitiveName(String *);
106
107
 
107
108
  String *runtimeCode();
108
109
  String *defaultExternalRuntimeFilename();
109
 
  String *buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname);
 
110
  String *buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname);
110
111
};
111
112
 
112
113
/* -----------------------------------------------------------------------
188
189
  /* Initialize all of the output files */
189
190
  String *outfile = Getattr(n, "outfile");
190
191
 
191
 
  f_runtime = NewFile(outfile, "w");
192
 
  if (!f_runtime) {
 
192
  f_begin = NewFile(outfile, "w", SWIG_output_files());
 
193
  if (!f_begin) {
193
194
    FileErrorDisplay(outfile);
194
195
    SWIG_exit(EXIT_FAILURE);
195
196
  }
 
197
  f_runtime = NewString("");
196
198
  f_init = NewString("");
197
199
  f_header = NewString("");
198
200
  f_wrappers = NewString("");
205
207
  /* Register file targets with the SWIG file handler */
206
208
  Swig_register_filebyname("header", f_header);
207
209
  Swig_register_filebyname("wrapper", f_wrappers);
 
210
  Swig_register_filebyname("begin", f_begin);
208
211
  Swig_register_filebyname("runtime", f_runtime);
209
212
  Swig_register_filebyname("init", f_init);
210
213
 
215
218
  clos_methods = NewString("");
216
219
  scm_const_defs = NewString("");
217
220
 
218
 
  Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
219
 
  Swig_banner(f_runtime);
 
221
  Swig_banner(f_begin);
220
222
 
221
 
  Printf(f_runtime, "/* Implementation : CHICKEN */\n\n");
 
223
  Printf(f_runtime, "\n");
 
224
  Printf(f_runtime, "#define SWIGCHICKEN\n");
222
225
 
223
226
  if (no_collection)
224
227
    Printf(f_runtime, "#define SWIG_CHICKEN_NO_COLLECTION 1\n");
225
228
 
 
229
  Printf(f_runtime, "\n");
 
230
 
226
231
  /* Set module name */
227
232
  module = Swig_copy_string(Char(Getattr(n, "name")));
228
233
  scmmodule = NewString(module);
251
256
  Printf(f_init, "#endif\n");
252
257
 
253
258
  Printf(chicken_filename, "%s%s.scm", SWIG_output_directory(), module);
254
 
  if ((f_scm = NewFile(chicken_filename, "w")) == 0) {
 
259
  if ((f_scm = NewFile(chicken_filename, "w", SWIG_output_files())) == 0) {
255
260
    FileErrorDisplay(chicken_filename);
256
261
    SWIG_exit(EXIT_FAILURE);
257
262
  }
258
263
 
259
 
  Printv(f_scm,
260
 
         ";; -*- buffer-read-only: t -*- vi: set ro:\n",
261
 
         ";; This file was created automatically by SWIG.\n", ";; Don't modify this file, modify the SWIG interface instead.\n", NIL);
 
264
  Swig_banner_target_lang(f_scm, ";;");
 
265
  Printf(f_scm, "\n");
 
266
 
262
267
  if (declare_unit)
263
268
    Printv(f_scm, "(declare (unit ", scmmodule, "))\n\n", NIL);
264
269
  Printv(f_scm, "(declare \n",
307
312
  /* Close all of the files */
308
313
  Delete(primitive_names);
309
314
  Delete(scmmodule);
310
 
  Dump(f_header, f_runtime);
311
 
  Dump(f_wrappers, f_runtime);
312
 
  Wrapper_pretty_print(f_init, f_runtime);
 
315
  Dump(f_runtime, f_begin);
 
316
  Dump(f_header, f_begin);
 
317
  Dump(f_wrappers, f_begin);
 
318
  Wrapper_pretty_print(f_init, f_begin);
313
319
  Delete(f_header);
314
320
  Delete(f_wrappers);
315
321
  Delete(f_sym_size);
316
322
  Delete(f_init);
317
 
  Close(f_runtime);
 
323
  Close(f_begin);
318
324
  Delete(f_runtime);
 
325
  Delete(f_begin);
319
326
  return SWIG_OK;
320
327
}
321
328
 
1233
1240
  return Language::importDirective(n);
1234
1241
}
1235
1242
 
1236
 
String *CHICKEN::buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname) {
 
1243
String *CHICKEN::buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname) {
1237
1244
  String *method_signature = NewString("");
1238
1245
  String *func_args = NewString("");
1239
1246
  String *func_call = NewString("");
1507
1514
   * If class_name = "" that means the mapping is for a function or
1508
1515
   * variable not attached to any class.
1509
1516
   * ------------------------------------------------------------ */
1510
 
String *CHICKEN::chickenNameMapping(String *name, String_or_char *class_name) {
 
1517
String *CHICKEN::chickenNameMapping(String *name, const_String_or_char_ptr class_name) {
1511
1518
  String *n = NewString("");
1512
1519
 
1513
1520
  if (Strcmp(class_name, "") == 0) {