Revision 1650

trunk/src/GNUmakefile (revision 1650)
330 330
	copy df1b2-separable\df1b2loc.h ${DIST}\include
331 331
	copy df1b2-separable\smartbuf.h ${DIST}\include
332 332
	copy nh99\admodel.h ${DIST}\include
333
	copy nh99\spcomm.h ${DIST}\include
334 333
	copy nh99\param_init_bounded_number_matrix.h ${DIST}\include
335 334
else
336 335
	mkdir -p ${DIST}/include
......
352 351
	cp df1b2-separable/df1b2loc.h ${DIST}/include
353 352
	cp df1b2-separable/smartbuf.h ${DIST}/include
354 353
	cp nh99/admodel.h ${DIST}/include
355
	cp nh99/spcomm.h ${DIST}/include
356 354
	cp nh99/param_init_bounded_number_matrix.h ${DIST}/include
357 355
endif
358 356

  
trunk/src/nh99/spcomm.cpp (revision 1650)
1
/*
2
 * $Id$
3
 *
4
 * Author: David Fournier
5
 * Copyright (c) 2008-2012 Regents of the University of California
6
 */
7
#include <windows.h>
8
#include <windows.h>
9
#include <winnt.h>
10
#include <ddeml.h>
11

  
12
#include <math.h>
13
#include <stdlib.h>
14
#include <spcomm.h>
15
#include <fvar.hpp>
16
//#include <admoddde.h>
17
//#include <ddesp.h>
18

  
19

  
20
DWORD DDEspclient::idInst=0;
21
DWORD DDEspclient::sleeptime=0;
22
HCONV DDEspclient::cstatus=NULL;
23
UINT  DDEspclient::status=0;
24

  
25
void check_when_finished(void);
26
void open_the_file(ifstream*& pifs, const int& waitflag, const int& numwaits);
27
void open_the_file_when_finished(ifstream*& pifs, const int& waitflag, const int& numwaits);
28

  
29
# if defined(STUPID_DDL_FUNCTIONS)
30
HDDEDATA CALLBACK mycallback(       //DdeCallback(
31
         UINT  uType,   // transaction type
32
         UINT  uFmt,    // clipboard data format
33
	 HCONV  hconv,	// handle of the conversation
34
	 HSZ  hsz1,     // handle of a string
35
	 HSZ  hsz2,     // handle of a string
36
	 HDDEDATA  hdata,	// handle of a global memory object
37
	 DWORD  dwData1,	// transaction-specific data
38
	 DWORD  dwData2 	// transaction-specific data
39
);
40

  
41

  
42
DDEspclient::DDEspclient(DWORD _sleeptime)
43
{
44
  status=DdeInitialize(&idInst, mycallback,CBF_FAIL_EXECUTES |
45
    CBF_SKIP_ALLNOTIFICATIONS,0);
46
  HSZ  hszService=DdeCreateStringHandle(idInst,"SPLUS", CP_WINANSI);
47
  HSZ  hszTopic=DdeCreateStringHandle(idInst,"SCommand", CP_WINANSI);
48

  
49
  if (status !=DMLERR_NO_ERROR)
50
  {
51
    printInitializestatus(status);
52
    cstatus=NULL;
53
  }
54
  else
55
  {
56
    cstatus=DdeConnect(idInst,hszService,hszTopic, NULL);
57
  }
58
}
59

  
60

  
61
void SPsend(const double& x, const adstring& name)
62
{
63
  ofstream ofs("c:\\tmp.spl");
64

  
65
  adstring command = name + adstring(" <- scan(\"c:\\\\tmp.spl\")");
66

  
67
  ofs << x;
68
  ofs << endl;
69
  ofs.close();
70
  SPexecute((unsigned char*)command,DDEspclient::get_cstatus());
71
  check_when_finished();
72
}
73

  
74
void SPsend(const dvector& x, const adstring& name)
75
{
76
  ofstream ofs("c:\\tmp.spl");
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff