The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Merging LabTalk and C

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
peter.cook Posted - 11/03/2003 : 06:57:51 AM
Hi,

Just a thought re using both LabTalk and C. I think it's possible to put all LabTalk code in a c file by defining strings as the LabTalk functions/sections etc. Using '\' makes the code manageable eg

void test()
{

string LTstring="loop(numloop,1,100) {data1_a[numloop]$="pete";};"

LTexecute(LTstring);

}


Deining LTstring as a static string enables it to be called by all functions in the c file.
I think (not sure) the way to enable all the LabTalk code to 'global' is to define a function that returns the LabTalk code as a string.

This to me seems really useful and will aid managing my code and evolving from LabTalk to C over time!

Does anyone have any comment or know of possible limitations/problems that may arise (length of string?).

(Origin 7.5 attaching C files to projects : even better!)

Cheers,

Pete



2   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 11/03/2003 : 11:57:13 AM
Thanks Easwar,

I guess the 'recommended' way is better! Getting carried away here...

Cheers,

Pete

easwar Posted - 11/03/2003 : 09:47:56 AM
Hi Pete,

Another way to do this is to organize your code as shown below. The Origin C compiler ignores everthing inside the ifdef LABTALK block (assuming of course LABTALK is not defined), and then to run the LabTalk code, you can issue commands from script such as:
run.section(file_path_and_name_of_C_file, MySection1)

Of course this is much easier in version 7.5 like you mentioned - Origin C files, LabTalk (OGS) files, or any other files can be attached and saved with an Origin Project.

In 7.5, when you issue a run.section command such as
run.section(just_file_name, section_name)
Origin will first look for a file and section of that name in attached files and run that if found. If not found, it will then look in User Files area, and then in the Origin EXE path.

Easwar
OriginLab.



#include <origin.h>

void MyOCFunction()
{
out_str("My OC Function\n");
}


#ifdef LABTALK
[MySection1]
type -b MySection1;
[MySection2]
type -b MySection2;
#endif LABTALK

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000