Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
111 user(s) are online (68 user(s) are browsing Forums)

Members: 0
Guests: 111

more...

Headlines

Forum Index


Board index » All Posts (billyfish)




How to allocate TimeRequest
Just popping in
Just popping in


Hi all

I'm trying to allocate a struct TimeRequest object and copying the code from the a2d.c example code from here, yet it fails to allocate the object using AllocSysObjectTags(). Is it something stupid that I'm doing??? I'm basically just after getting the ITimer interface so is there another way to do it?

cheers

billy

// a2d.c
#include <exec/types.h>
#include <exec/memory.h>
#include <dos/datetime.h>
#include <devices/timer.h>

// Note these three libraries are opened by newlib startup code.
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/utility.h>

#include <proto/timer.h>

struct TimerIFace *ITimer NULL;

int main()
{
    
struct TimeRequest *tr IExec->AllocSysObjectTags(ASOT_IOREQUEST,
    
ASOIOR_Sizesizeof(struct TimeRequest),
    
ASOIOR_ReplyPortNULL,
        
TAG_END);

  if (
tr != NULL)
  {
    if (!(
IExec->OpenDevice("timer.device"UNIT_VBLANK, (struct IORequest *)tr0) ))
    {
            
struct Library *TimerBase = (struct Library *) tr->Request.io_Device;
      
ITimer = (struct TimerIFace*)IExec->GetInterface(TimerBase"main"1NULL);

      if (
ITimer != NULL)
      {
        
struct TimeVal tv;
        
ITimer->GetSysTime(&tv);

        
IDOS->Printf("GetSysTime():\t%d %d\n"tv.Secondstv.Microseconds);

        
struct ClockData clockdata;
        
IUtility->Amiga2Date(tv.Seconds, &clockdata);

        
IDOS->Printf("Amiga2Date():  sec %d min %d hour %d\n",
          
clockdata.secclockdata.minclockdata.hour);

        
IDOS->Printf("               mday %d month %d year %d wday %d\n",
                    
clockdata.mdayclockdata.monthclockdata.yearclockdata.wday);

        
int32 seconds IUtility->CheckDate(&clockdata);

        
IDOS->Printf("CheckDate():\t%ld\n"seconds);

        
seconds IUtility->Date2Amiga(&clockdata);

        
IDOS->Printf("Date2Amiga():\t%ld\n"seconds);

                
IExec->DropInterface((struct Interface*)ITimer);
      }

      
IExec->CloseDevice((struct IORequest *)tr);
    }

        
IExec->FreeSysObject(ASOT_IOREQUESTtr);
    }
    else
    {
        
IDOS->Printf ("Failed to allocate TimeRequest\n");
    }

  return 
RETURN_OK;
}


Edited by billyfish on 2020/5/17 18:56:26
Go to top


Re: updating sgit
Just popping in
Just popping in


@Walkero and @mdr

Awesome! I'll set up a place to download the work in progress versions from. Unfortunately I spoke too soon about the updated version of libgit2 as it crashes in the posix layer bits (open, read, unlink, etc.) so I need to try and track these down. So I've updated the build code so I can build a version of simplegit that use the previous version as before (version 0.26.3) and another that uses the latest (1.0.0). I'm also trying to get the native build to work as it's a bit of a pain to keep building on my pc and copying the executeables across to my Amiga

billy

Go to top


Re: updating sgit
Just popping in
Just popping in


Hi all


Ok I have built an initial version of simplegit using the latest libgit. No new features added yet, that will be the next stage. Is anyone willing to beta test this?

cheers

billy

Go to top


Re: updating sgit
Just popping in
Just popping in


@Hans

I'm open to ideas, no need for a bounty or anything like that. I've forked libgit2 to https://github.com/billyfish/libgit2/tree/amigaos4_port and a naive look at the src/unix and src/win32 folders might give a vague idea of what might be needed to give a similar src/amiga folder.

If this can be brought up to date, the simplegit part, which is the layer that sits on top of this library, should be much easier to bring up to date. In fact, using libgit2, a gui such as tortoisegit or gitkraken, might be achievable.

In terms of compiling libgit2, the first error is the lack of struct timespec, has anyone added functionality for this for any OS4 software yet? If I have to do similar to https://github.com/billyfish/libgit2/b ... /src/win32/win32-compat.h then that's fine, it's just seeing if I can use existing ports to get things moving quicker.

For simplegit itself, I think I can use Fredrik Wikstrom's work on SSHTerm to get the latest libssh2 code working.

I don't know if this even vaguely answers your question, but these are the various ideas I have circling my head.



Billy

Go to top


Re: updating sgit
Just popping in
Just popping in


@Hans

Sorry for the loooooong delay about this. My plan to update sgit hit a couple of major snags. Apart from my spare time getting squeezed by my research work taking up way more time than I anticipated, I got my head around the way that simplegit was working and then realised the major issue.

So simplegit is a wrapper that calls libgit2 (https://libgit2.org/) for its actual git functionality. Now simplegit uses a fork of libgit2 (https://github.com/sba1/libgit2/tree/a ... e14a6487a3de17174ef9ac831) so to get the latest git functionality requires this being brought up to data as it is currently 1729 commits behond the main libgit repo. So consequently that is a lot of upstream changes to pull in and I was bracing myself as to how to go about this. If it can be brought up to date, then I would definitely make a pull request to get the amiga-specfic changes into the main tree so we don't have to go through this again.

If you want the latest snapshot of how far I'd progressed with sgit, its available at

https://drive.google.com/open?id=1wogEmqm4cyytWmjU6eNPenTyQiyQ-i1f

It's quite a while so my memory is a bit hazy, from what I remember the commit behaviour has been update to be like the standard git behaviour so that

sgit commit -a -m "..."

where the -a flag automatically stages files that have been modified and deleted, but new files you have not told Git about are not affected.

I will try and take another look at this to see what further updates I can do. However the big win will be to get the libgit2 part back up to date.

cheers

billy

Go to top


Re: Lha compressor for Linux?
Just popping in
Just popping in


@Hans

On ubuntu

sudo apt install lhasa

gives you lha

cheers

billy

Go to top


Re: Downloads keep failing on OSDepot
Just popping in
Just popping in


@orgin

This may be a long shot, but is there any anti-intrusion program running on your server? The reason I ask is that the server I administer at work kept having issues with failing downloads. In the logs it would appear as "Connection reset by peers" as if people had cancelled their downloads. However what was actually happening was that the anti-intrusion software that was running on the server was getting false positives for our software and killing the connections.


Go to top


Re: updating sgit
Just popping in
Just popping in


@mdr

Awesome, I managed to confirm your issue yesterday as I'm finally getting some time back on sgit again, hurrah! I'll keeo you posted chaps, my aim is to have a version with the move and commit updates finished in the next week or two. I'll make this available and then start on the issues and updates that you guys have mentioned, keep them coming

Go to top


Re: updating sgit
Just popping in
Just popping in


@Hans

I absolutely agree! So you're seeing delays if you're simply adding single files at a time in the root directory? E.g. If you do

sgit add foo_0.c
sgit add foo_1.c
sgit add foo_2.c
................
sgit add foo_n.c

on an empty repo are all of them slow or does the delay increase, the more files you add? Just working out what I need to replicate to see it.

As for a debugger, I absolutely agree again! I need to take another look at db101, but anything like gdb would be a huge boon for development

cheers

billy


Go to top


Re: updating sgit
Just popping in
Just popping in


@mdr

Hi sorry for the delay, I'l be able to get back to this in the next couple of weeks and then I'll be able to stop making binaries available.

Hiding my eyes behind my hands what errors are you getting?


Go to top


Re: updating sgit
Just popping in
Just popping in


@Hans

It's been a crazy few weeks and my spare time for working on sgit has been non-existant! It should become a bit mnore relaxed in a couple of weeks and then I can get back to this.

Thanks for the extra bits to look at. Part of my initial work for the commit command used the git_status_list.. () api that's in libgit and it might be that helps if I use that for the git status command too.

Go to top


Re: expat.library element length
Just popping in
Just popping in


@mritter0

For problem 1, if it's a sax parser, then you need to have a buffer that you use to get the data. So you have StartElement () and EndElement () calls that tell you when an element is started and finished. In between them the data handler can get called multiple times, in your case CharacterElement, and you have to append the data chunks together yourself. Does that make sense?


For problem 2, I'd need more info but you should have a lifecycle like

StartElement for Keywords
StartElement for ReservedWords
One or more calls to CharacterElement
EndElement for ReservedWords
EndElement for Keywords


Go to top


Re: updating sgit
Just popping in
Just popping in


Hi all

Wow! I'm glad there's interest! I've added the issues page on my forked repo at https://github.com/billyfish/simplegit/issues, if you want to add them in.

Once I've finished the support for "sgit mv", I can start working through these.

Keep them coming!

cheers


billy


Go to top


Re: updating sgit
Just popping in
Just popping in


@sTix

Interesting! Is this fully working on AROS and MorphOS? Might be the way to go...

Go to top


Re: updating sgit
Just popping in
Just popping in


@walkero

Sure

So far I've added the -a switch for the commit command which automatically stages files that have been modified and deleted, but ignore new files you have not told Git about.

I'm in the process of adding support for the mv command and setting up the default push behaviour when the repository and refspec aren't specified. Basically I'm plugging the holes of my most common git workflow so I can do:

sgit commit -a -m "blah"
sgit push

the same as I do with the standard git command.

Feel free to suggest any features that you are interested in and I'll see what I can do.

cheers

Billy

Go to top


Re: updating sgit
Just popping in
Just popping in


@Raziel

That's entirely what I'm going to do!
I've forked it and after I'm happy with it all, I'll make a pull request.

cheers

Billy

Go to top


updating sgit
Just popping in
Just popping in


Hi all

I've been tinkering with a fork of sgit to add in some of the standard git features that it is missing. Before I make a pull request with the additions, I'm checking to see if anyone is interested in using it as some extra testing. If you're interested, just drop me a line.

billy

Go to top


Re: library auto init code (solved)
Just popping in
Just popping in


I'm revisiting this code as I'm about to release a new version of the library code generation project that this was all part of as well as open sourcing it.

I'll check the code with the assert () calls in, I think I just refactored the code the generated by IDLTool, but I could be wrong.

Go to top


Re: How detect and fix heap trashing ?
Just popping in
Just popping in


@kas1e

try this

/***********************************************************************
 *            Set the text in a menu / submenu option                  *
 ***********************************************************************/

void menu_entry_set_settingtextmenuEntry entrychar text )
{
    
char str[256];
    
    
/* this could overflow */
    
strcpyentry->settingtexttext );

    if( 
entry->text_obj != (textObj *)){
        if( 
entry->show_subsetting && entry->settingtext[0]!=){
            
int res snprintf(str256"%s : %s",entry->text,entry->settingtext);

            if (
res 256) {
              
printf ("string not large enough for \"%s\" and \"%s\"\\n"entry->text,entry->settingtext);
            }

            
textObj_setTextentry->text_objstr );
        } else {
            
textObj_setTextentry->text_objtext );
        }
    }
}

/***********************************************************************
 *          Create the menu textobject for opengl displaying           *
 ***********************************************************************/

void menu_create_textobjmenuEntry entry )
{
    
char str[256];
    if( 
entry->text_obj == (textObj *)){


        if( 
entry->show_subsetting && entry->settingtext[0]!=){
            
int res snprintf(str256"%s : %s",entry->text,entry->settingtext);

            if (
res 256) {
              
printf ("string not large enough for \"%s\" and \"%s\"\\n"entry->text,entry->settingtext);
            }


            
entry->text_obj textObj_newstrentry->fontnameentry->fontsize );
        } else {
            
entry->text_obj textObj_newentry->textentry->fontnameentry->fontsize );
        }
    }
}

Go to top


Re: What the best and fast way to get list of files/dirs in the directory
Just popping in
Just popping in


@kas1e

char **GetFileNameInDirectory (const chardir
{
    
char **filenames_pp NULL;
    
struct ExamineData *data_p IDOS->ExamineObjectTags (EX_StringNameInputdirTAG_END);
    
    if (
data_p)
        {
            if (
EXD_IS_DIRECTORY (data_p))
                {
                    
APTR context_p IDOS->ObtainDirContextTags (EX_StringNameInputdir,
                        
EX_DataFields, (EXF_NAME EXF_LINK EXF_TYPE),
                        
TAG_END);
                
                    if (
context_p)
                        {
              
struct List *names_p IExec->AllocSysObjectTags (ASOT_LISTTAG_DONE);

              if (
names_p)
                {
                  
struct ExamineData *dat_p;
                  
size_t num_entries 0;

                                
/*
                                    context_p takes care of deleting the returned dat_p objects
                                    when we call ReleaseDirContext, so we mustn't call 
                                    FreeDosObject on them
                                */
                                
while ((dat_p IDOS->ExamineDir (context_p)))
                                    {
                                        if (
EXD_IS_FILE (dat_p))
                                            {
                          
char *copied_name_p CopyToNewString (dat_p -> Name);

                          if (
copied_name_p)
                            {
                              
struct Node *node_p IExec->AllocSysObjectTags (ASOT_NODE,
                                                      
ASONODE_Namecopied_name_p,
                                                      
ASONODE_Sizesizeof (struct Node),
                                                    
TAG_DONE);       
                                                
                                                  if (
node_p)
                                                      {
                                                        
IExec->AddTail (names_pnode_p);
                                  ++ 
num_entries;
                                                      }
                                                  }
                                              }
                                    }
                    
                                if (
ERROR_NO_MORE_ENTRIES != IDOS->IoErr ())
                                    {
                                        
IDOS->Printf ("Failed to obtain directory context for "%s"n"dir);
                                        
IDOS->PrintFault (IDOS->IoErr (), NULL); /* failure - why ? */
                                    
}                        
                  else
                    {
                      
filenames_pp = (char **) IExec->AllocVecTags (num_entries sizeof (char *), TAG_DONE);

                      if (
filenames_pp)
                        {
                          
char *current_filename_pp filenames_pp;
                          
struct Node *node_p IExec->GetHead (names_p);
                          
struct Node *next_node_p NULL;

                            while (
node_p)
                                {
                                    if (
node_p -> ln_Name)
                                        {
                                  *
current_filename_pp node_p -> ln_Name;

                                  ++ 
current_filename_pp;
                                            (
node_p -> ln_Name NULL;
                                        }

                                    
next_node_p IExec->GetSucc (node_p);
                                    
IExec->FreeSysObject (ASOT_NODEnode_p);
                                    
node_p next_node_p;
                                }

                        }

                    }

                  
IExec->FreeSysObject (ASOT_LIST, (APTRlist_p);
                }
                                        
                            
IDOS->ReleaseDirContext (context_p);          /* NULL safe */
                        
}        /* if (context_p) */
                    
else
                        {
                            
IDOS->Printf ("oopsn");
                            
IDOS->PrintFault (IDOS->IoErr (), NULL);  /* no context - why ? */
                        
}                    
                    
                }        
/* if (EXD_IS_DIRECTORY (data_p)) */    
        
            
IDOS->FreeDosObject (DOS_EXAMINEDATAdata_p);
        }        
/* if (data_p) */

    
return filenames_pp;
}


char *CopyToNewString (const char *src_p)
{
  
char *dest_p NULL;

  if (
src_p)
    {
      
size_t len strlen (src_p);
        
dest_p = (char *) IExec->AllocVecTags (len 1TAG_DONE);

        if (
dest_p)
            {
                
strcpy (dest_pstart_p);
            }
     }
  
  return 
dest_p;
}

Go to top



TopTop
« 1 ... 4 5 6 (7) 8 9 »




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project