clang.md

00001 # clang  (OS X) {#clang}
00002 
00003 The following instructions were performed on
00004 
00005     $ sw_vers
00006     ProductName:  Mac OS X
00007     ProductVersion: 10.10.5
00008     BuildVersion: 14F27
00009     $ gcc --version
00010     Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
00011     Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
00012     Target: x86_64-apple-darwin14.5.0
00013     Thread model: posix
00014 
00015 ## Copy Files
00016 
00017     $ cd ~
00018     $ mkdir test
00019     $ cd test
00020     $ tar -xzf /Applications/gclib/examples/gclib_229_examples.tar.gz
00021     $ cp /Applications/gclib/include/* .
00022     $ cp /Applications/gclib/dylib/* .
00023     $ ls
00024     gclib.0.dylib   x_arrays.cpp    x_gmotioncomplete.cpp
00025     gclib.h     x_examples.cpp    x_gread_gwrite.cpp
00026     gclib_errors.h    x_examples.h    x_grecord.cpp
00027     gclib_record.h    x_gcommand.cpp    x_nonblocking.cpp
00028     gclibo.0.dylib    x_ginterrupt.cpp  x_programs.cpp
00029     gclibo.h    x_gmessage.cpp    x_simple.c
00030 
00031 ## 
00032 
00033 ## x_simple.c
00034 
00035 * In a text editor, open *x_simple.c*. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options. 
00036 
00037 ### Compile
00038 
00039     $ gcc -Wall -Werror x_simple.c gclib.0.dylib gclibo.0.dylib -o simple
00040 
00041 ### Run
00042 
00043     $ ./simple 
00044     rc: 0
00045     version: 126.108.229
00046     rc: 0
00047     rc: 0
00048     info: 10.1.3.142, DMC4020 Rev 1.2a-BH, 291
00049     rc: 0
00050     response:  206676.0000
00051     :
00052 
00053 ## x_examples.cpp
00054 * In a text editor, open *x_examples.cpp*. Find the GOpen() call and update the address to match the desired hardware. See the documentation for GOpen() for address formatting options. Don't forget `-s ALL` if data records, interrupts, and messages are to be tested.
00055 * Find the `#if 0` preprocessor block enclosing the example calls. Change to `#if 1` to run the examples. Comment out the function calls to be avoided. Note some calls attempt to move motors and not all functions are compatible with all Galil products.
00056 
00057 ### Compile
00058 
00059     $ g++ x_*.cpp gclib.0.dylib gclibo.0.dylib -o example
00060 
00061 ### Run
00062     
00063     $ ./example 
00064     Library version: 126.108.229
00065     
00066     10.1.3.142, DMC4020 Rev 1.2a-BH, 291
00067     
00068     ************************************************************************
00069     Example GRead() and GWrite() usage
00070     ************************************************************************
00071     
00072     Read 1 byte(s)
00073     :
00074     Program test OK.
00075     
00076     ************************************************************************
00077     Example GCommand() usage
00078     ************************************************************************
00079     Revision report, ^R^V
00080     DMC4020 Rev 1.2a-BH
00081     :
00082     
00083     Command Values
00084     val is 10
00085     val is 11
00086     val is 3.1415
00087     val is 9.869
00088     
00089     Command Trimming
00090     > 408978.0000
00091     :<
00092     > 408978.0000<
00093     >408978.0000<
00094     
00095     Receiving Binary Data
00096     QR read 155 bytes
00097     
00098     Error handling
00099     QD correctly trapped, not allowed, try GArrayDownload()
00100     DL correctly trapped, not allowed, try GProgramDownload()
00101     
00102     Modifying timeout
00103     Burning program...OK
00104     
00105     ************************************************************************
00106     Example GProgramDownload() and GProgramUpload() usage
00107     ************************************************************************
00108     GProgramDownload() correctly errored. Can't fit with level 3 compression
00109     Program Downloaded with compression level 4
00110     Uploading program:
00111     #A;i=0;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1
00112     i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;EN
00113     
00114     Program executed as expected
00115     ************************************************************************
00116     Example GArrayDownload(), GArrayUploadFile()
00117     GArrayDownloadFile(), and GArrayUpload usage
00118     ************************************************************************
00119     2.0000, 4.0000, 6.0000, 8.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
00120     
00121     2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
00122     
00123     3.0000, 5.0000, 10.0000
00124     2.0000, 1.0000, 3.0000, 5.0000, 10.0000, 12.0000, 14.0000, 16.0000, 18.0000, 20.0000
00125     
00126     
00127     ************************************************************************
00128     Example GRecord() usage
00129     ************************************************************************
00130     
00131     QR-based data record
00132     18358
00133     0
00134     
00135     DR-based data record
00136     18462
00137     18564
00138     18666
00139     18768
00140     18870
00141     18972
00142     19074
00143     19176
00144     19278
00145     19380
00146     19482
00147     
00148     QR-based data record with offsets
00149     19482
00150     19482
00151     
00152     ************************************************************************
00153     Example GMessage() usage
00154     ************************************************************************
00155      0.0000
00156      1.0000
00157      2.0000
00158      3.0000
00159      4.0000
00160      5.0000
00161      6.0000
00162      7.0000
00163      8.0000
00164      9.0000
00165     
00166     ************************************************************************
00167     Example GInterrupt() usage
00168     ************************************************************************
00169     "UI 8" executed.
00170     
00171     ************************************************************************
00172     Example GMotionComplete() usage
00173     ************************************************************************
00174     
00175     Position: 0, 0
00176     Beginning independent motion... Motion Complete on A
00177     Position: 8000, 0
00178     
00179     Position: 0, 0
00180     Beginning vector motion... Motion Complete on vector plane S
00181     Position: 6000, 0
00182     
00183     ************************************************************************
00184     Example GMessage non-blocking usage
00185     ************************************************************************
00186      422902.0000
00187     
00188     
00189     ************************************************************************
00190     Example GInterrupt non-blocking usage
00191     ************************************************************************
00192      F1
00193     
00194     ************************************************************************
00195     Example GRecord non-blocking usage
00196     ************************************************************************
00197      33786
00198     
00199     
00200     examples.cpp executed OK
00201     main() is finished. Press Enter to exit: