|
harold aptroot wrote: It's not that much Java based, it can generate parsers in many languages (including C#)
But you need to have Java installed to run it
Is is Java based. However, as you correctly pointed out may generate parsers for many target languages [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
For grammars there is a beautiful IDE (until it, eventually, hangs...), ANTLRWorks [^]. I really don't know a good Java IDE , I liked more NetBeans than Eclipse , because the latter was, in my experience, deadly slow.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Let me explain in a more detail way.
I'm creating my own language and compiler for.NET framework for the purpose of simulating microprocessor specifally 8086.
so what my user going to do is to write a code in my new language grammer and compile the result by my compiler to see what a real processor will resposed for that code. just like emu8086 software if u see it.
to this end I have to go through all the steps of compiler construction. that's why I got through MSIL and then to registers which actually uses machine language.
my problem is i can't get machine code through MSIL which uses stack based execuition but i need register based execuition for getting these machine code.
or if u have any other options please suggest me?
thank you!
|
|
|
|
|
You cannot use the .NET enviornment, compilers, ..., .NET anything to generate your code. The .NET Framework will not run on a 8086 machine.
You can write your own x86 compiler in C#, you just cannot use the .NET Frameworks CodeDom to create your compiler.
|
|
|
|
|
This exact same quetsion came up last week. Again, .NET's compiler and the fact that it's exection is stack based has absolutely no bearing on your compiler or simulator. The only way it could was if you were using the .NET compilers in your own "compiler" to do all of the work for you. In that case, you're not writing your own compiler, just wrapping the .NET compilers. This won't work for you since the .NET compilers do not generate native x86 code.
|
|
|
|
|
now i'm figuring out something
just to forget about MSIL and continue with functions and arrays to get 8086 code and return the same way
|
|
|
|
|
Yes! That's the idea! You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
thank u very much
I'll try to do it this way
and we will contact if anything goes wrong
thanks
|
|
|
|
|
Hi All,
I want to be able to create an instance of a COM object dynamically, given it's GUID. Having created an instance of the COM object I would like to use reflection to show in a list control the functions that this object exports. I don't want to import the COM object at design time and create a class from it - the COM object is changing regularly, it's a test harness that's being developed concurrently by a set of users.
Is this possible? If so, how do I create the COM object from the GUID only?
Thanks in advance,
Dave Kerr
|
|
|
|
|
Creating the COM object is no problem, but such objects do not support reflection. The only way to get the information you need is through the object's type library. There are a number of COM articles here on CodeProject that include suggestions as to how to proceed with this. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
You can use GetTypeFromCLSID to get a COM Type give its GUID.
Then you can use Activator.CreateInstance to create an object instance from that Type.
|
|
|
|
|
Mirko1980 wrote: Then you can use Activator.CreateInstance to create an object instance from that Type. "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/IV
Support CRY- Child Relief and You
|
|
|
|
|
Refer also to Richard's answer: I fear you can't get full Reflection information from a COM object.
|
|
|
|
|
Thanks for the info, so as I understand it, I can use Activator.CreateInstance to get the COM object, but I cannot use reflection.
However, can I programmatically load the type library and get the function names from that? Again, I don't want to create a class from the type library, but dynamically retrieve the function names and parameters they take from a type library at runtime...
|
|
|
|
|
DaveKerr wrote: so as I understand it, I can use Activator.CreateInstance to get the COM object, but I cannot use reflection
You can, as long as the component supports IDispatch you can use the CustomMarshaller assembly (you'll commonly find it in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727). The following code sample displays the members of DirControl.DirList.8.0 using reflection:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.CustomMarshalers;
using System.Reflection;
namespace ComMarshaller
{
[
ComImport,
Guid("00020400-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
]
public interface IDispatch
{
void Reserved();
[PreserveSig]
int GetTypeInfo(uint nInfo, int lcid,
[MarshalAs(
UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(TypeToTypeInfoMarshaler))]
out Type typeInfo);
}
class Program
{
static void Main(string[] args)
{
Type type = Type.GetTypeFromProgID("DirControl.DirList.8.0");
object o = Activator.CreateInstance(type);
IDispatch disp = o as IDispatch;
if (disp != null)
{
Type tp = null;
disp.GetTypeInfo(0, 0, out tp);
MemberInfo[] mi = tp.GetMembers();
foreach (MemberInfo minfo in mi)
{
Console.WriteLine(minfo.Name);
}
}
Console.WriteLine("Done");
Console.ReadKey();
}
}
} Remember, this needs CustomMarshaller.dll added as a reference in your application."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
extremly sorry, am very new to c# enviornment!
|
|
|
|
|
By using wild card i added an item in Windows context menu of all files now i want to add exception for some files for example i want an option "abc" to show in every files context menu except .jpg files.
can any one guide me how to add this exception and an example would really be appreciated.
thanks in advanceshezi
|
|
|
|
|
hi all
i am trying to convert a excel file data to a dataset using
Microsoft.Office.Interop.Excel.range
anyone know how to do?
i tryed to read the information cell by cell and populate the dataset however it take a very long time.
|
|
|
|
|
you can also do thi without using Microsoft.Office.Interop.Excel.range
just using this
public static DataSet getDataSet(string strFilename)
{
string connstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\excels\" + strFilename + ";";
connstr += @"Extended Properties=""Excel 12.0;HDR=YES;""";
OleDbConnection conn = new OleDbConnection(connstr);
OleDbCommand cmd = new OleDbCommand("sheet1", conn);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(ds);
da.Dispose();
conn.Dispose();
cmd.Dispose();
return ds;
}
|
|
|
|
|
I use ClipBoard to copy an image to my application.
I use this code for my application:
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap) == true)
{
// Do something
}
I press Ctrl-C on an image, and press Ctrl-V on my application, the code inside if statement doesn't fire.
Can anyone help me on this?
Thanks a lot.
|
|
|
|
|
That IF statement works fine for me when there is a bitmap on the clipboard. Add some more information:
Where are you copying the image from? Does it paste into other applications after you copy it? Where is your IF statement located (in an event handler that intercepts CTRL+V, I would assume)? Have you confired that the code OUTSIDE of the IF statement gets fired?
Post some more code... such as the event handler you are using to capture CTRL+V.
|
|
|
|
|
I copy an image from Window Explorer, or Desktop, and whenever I press Ctrl-V on my application, it does not work as I wish.
It works fine with Microsoft Word.
I catch an event after user clicks Ctrl-V, the code outside IF statement is fired, but not the one inside.
Those are the code that I have done so far:
private void OnKeyDown(Object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control)
{
// Some code
if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Bitmap) == true)
{
// Do something
}
}
}
Thanks.
|
|
|
|
|
Put a breakpoint on the "if( Clipboard..." line, and see what formats are present.
It may make it easier if you separate the Cliboard.GetDataObject().GetDatePresent(...) into two and examine the Cliboard.GetDataObject() alone.You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
I imagine bitmap is not one of the formats copied when you copy a file. When I tried it, I copied from MS Paint, not from Explorer. I'm pretty sure there is a data format for files/folders... and I think just the path to the file is stored, rather than the file data. In addition to checking for bitmaps, check for files and then you'll have to load the file based on the path.
|
|
|
|
|
highton wrote: I copy an image from Window Explorer, or Desktop
No you didn't, since neither will display an image. You, more than likely, copied a file path that points to an image file to the Clipboard.
|
|
|
|